HTML Entities in ReasonML/ReasonReact


#1

How do you render HTML entities to the DOM using ReasonML/ReasonReact?


#2

See Stack Overflow: How to add a copyright symbol in reason-react component?


#3

It looks like this works for only a certain set of characters at the moment. I was trying to create menu bars:


#4

Ah, I have to use dangerouslySetInnerHTML={{ "__html": "☰" }}. Didn’t want to have to do that but oh well.


#5

I don’t see why that wouldn’t work with just Unicode, but yeah if you have to emit actual HTML entities then you have to wrap it in another element.

This is an issue with React, not Reason or ReasonReact, btw, so other solutions might be, or become, possible if React enables them.