I was calling in data from an api and data has special characters. For eg in object returned :
{
question : "In which year did the British television series "The Bill" end?"
}
If I store this value in a variable it saves as a string and when I call this variable using JSX, itthinks its a string and doesn't recognize special characters.
How can I solve this?
export default function Quiz(props){
const element = "In which year did the British television series "The Bill" end?"
return (
<main>
{element}
</main>
)
}
I want to render this on the screen
In which year did the British television series "The Bill" end?
dangerouslySetInnerHTMLbut that's probably to be avoided.