How to replace html entities in api response with React?

So I was making a random music quiz application using react and I have run into a problem. I am getting the questions from an api but The api question and answers includes html entities that are not being converted on the rendered page. I’m wondering what can I do about them, I have tried using .replace but everywhere I have tried putting it so far I am getting an error in the console saying it is not a function. Is there some way to get the page to properly render the entities ? Or how I can replace them from the jsx? Or am I just better off using a different api?(I would though prefer to use this one, as it is free and served over an https connection with lots of questions).
Here is my code


.replace should work. Here’s how you might implement it:

const entities = {
  ''': "'",
  '"': '"',
  // add more if needed
// ...
<div ...>{data.results[i].question.replace(/&#?\w+;/, match => entites[match])}</div>
1 Like

Thanks, that did it! You are awesome @kevcomedia