Home > OS >  Change from text to span in react.js
Change from text to span in react.js

Time:10-24

I would like the a tag to change to span when the variable 'nav' is false. When I try to do this, the text literally changes to " home " and I wish it would become an icon. What can I do?

<a href="/">{nav ? 'HOME' : "<span > home </span>"}</a>

CodePudding user response:

Remove " "

<a href="/">{nav ? 'HOME' : <span > home </span>}</a>

CodePudding user response:

Maybe move the code inside the class property and return an empty string when nav is true and material-symbols-outlined when its false

  • Related