When adding icons inside the js condition, the icon appears as an object only, and the icon does not appear
{!signUp ? `${(<FcGoogle />)}` + "Signin With Google": `${(<FcGoogle />)} SignUp With Google`}
When adding icons inside the js condition, the icon appears as an object only, and the icon does not appear
{!signUp ? `${(<FcGoogle />)}` + "Signin With Google": `${(<FcGoogle />)} SignUp With Google`}
2
Answers
You cannot put components inside a string since they are functions that do not return strings. You could either remove the “ around or (IMO) better:
If the icon we render doesn’t change depending on the value
signUp
; a cleaner approach to solve this challenge would be use a ternary inside the string and conditionally render the text like below:This has the added benefit of keeping our code DRY also.