I'm trying to insert an image depending on a state - but this will display the string of img src=${redExclamation} .
return `${
isEmpty
? `<img src=${redExclamation} />`
: `<img src=${greenCheck} /> `
}`;
I've tried it a different way where i got rid of the string literal:
return `${
isEmpty
? <img src=${redExclamation} />
: <img src=${greenCheck} />
}`;
But this will show [object Object] in the HTML. Not sure what I should be doing here. Any help would be appreciated!
you are returning a string, not html.
return isEmpty
? <img src={redExclamation} />
: <img src={greenCheck} />;
Might be what you need