Render Tags in Strings

In my database (before I began migration to Rescript), I had stored string values for certain fields. For example, it could have been
"Foo Bar Test Word Word Word \<b>emphasize\</b> \<ul>\<li>List Item\</li>\<li>Item2\</li>\</ul>"
However, I have not been able to fix or change this behavior while using Rescript (perhaps due to the type safety imposed by React.string). Is there any way to render or interpolate those tags within the string? If not, are there any alternative ideas you can suggest?

If you remove the backslashes in your string, could you use dangerouslySetInnerHTML?

let html = "Foo Bar Test Word Word Word <b>emphasize</b> <ul><li>List Item</li><li>Item2</li></ul>"
let el = <div dangerouslySetInnerHTML={{"__html": html}} />
1 Like

Let me try that, thanks! (I had put the backslashes because otherwise the forum was applying the HTML styles)