0

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>&#8594</span> //in html this is a right arrow, in React this is just a plain code
</div>

2 Answers 2

2

Please use the ending semi-colon ; for the hex code to get rendered.

example: &#8594;

See CodeSandbox example: Click here

Sign up to request clarification or add additional context in comments.

Comments

2

Inline a string using javascript unicode escapes. Right arrow is 2192 in Unicode hex. (0x2192 == decimal 8594)

<span>{"\u2192"}</span>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.