How to safely render html in react?

I've got some user generated html markup from a text area and I'd like to render it on another part of the screen. The markup is saved as a string in the props of the component.

I don't want to use dangerouslysethtml for obvious reasons. Is there a parser such as marked but for html so that it strips out script tags and other invalid html.

Replay

Sanitize the html using the sanitize-html module, and render it using dangerouslySetInnerHTML, as it will be dangerous no more.

Category: html Time: 2016-07-29 Views: 0
Tags: html reactjs

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.201 (s). 12 q(s)