How to add a copyright symbol in reason-react component?

bonheury picture bonheury · Feb 28, 2018 · Viewed 8.7k times · Source

I’m new to reason-react. I’m trying to put a copyright symbol in a react-reason component. I've tried

<span >(ReasonReact.stringToElement("&copy;"))</span>

but this doesn’t give me the © symbol.

Answer

Neil Kistner picture Neil Kistner · Feb 28, 2018

If you're doing HTML entities like that you have to use the dangerouslySetInnerHTML attribute like so:

<span dangerouslySetInnerHTML={{ "__html": "&copy;" }} />