1I have tried this pure component:
2
3const RawHTML = ({children, className = ""}) =>
4<div className={className}
5 dangerouslySetInnerHTML={{ __html: children.replace(/\n/g, '<br />')}} />
6Features
7
8Takes classNameprop (easier to style it)
9Replaces \n to <br /> (you often want to do that)
10Place content as children when using the component like:
11<RawHTML>{myHTML}</RawHTML>
12I have placed the component in a Gist at Github: RawHTML: ReactJS pure component to render HTML
13
14Share