Safe alternative to dangerouslySetInnerHTML

If XSS is your primary concern, you can use DOMPurify to sanitize your HTML before inserting it in the DOM via dangerouslySetInnerHTML. It’s just 10K minified. And it works in Node too.

Leave a Comment