I'm trying to render an ✕ and ✓, conditionally with JSX, but this approach doesn't work.
<div>{exists ? ✓ : ✕}</div>
What would be the right solution for achieving this?
CodePudding user response:
You have to wrap that using span
and span should have an attribute of role="img"
otherwise React will show warning.
<div>{true ? <span role="img">✓</span> : <span role="img">✕</span>}</div>
CodePudding user response:
Please refer to the following code:
{exists ? <div>✕</div> : <div>✓</div>}