Skip to content Skip to sidebar Skip to footer

Reactjs Dangerouslysetinnerhtml Alternatives

So I'm currently building a blogpost and the entire 'post' of this JSON file contains HTML in it, things like

or and such. What's the most efficient

Solution 1:

You can use DOMPurify to sanitize your HTML before inserting it in the DOM via dangerouslySetInnerHTML. Hope it works!

Post a Comment for "Reactjs Dangerouslysetinnerhtml Alternatives"