Reputation: 55
Is there any way I can include an icon using ASCII code in React. I have done this in HTML and it works just fine, but when thing comes to React it just renders the whole string code
<div class="page-btn">
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>→</span> //in html this is a right arrow, in React this is just a plain code
</div>
Upvotes: 0
Views: 3201
Reputation: 104539
Inline a string using javascript unicode escapes. Right arrow is 2192 in Unicode hex. (0x2192 == decimal 8594)
<span>{"\u2192"}</span>
Upvotes: 2
Reputation: 693
Please use the ending semi-colon ;
for the hex code to get rendered.
example: →
See CodeSandbox example: Click here
Upvotes: 2