Latest news:

New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!

How to insert HTML in react js?

How to insert HTML in react js?

In react project sometimes need to show raw HTML content. React simply does not allow us to put raw HTML content.
In that case we need to use dangerouslySetInnerHTML dom element in order to resolve that issue. For example

render: function() {
    return (
        <div className="myClassName" dangerouslySetInnerHTML={{__html: this.state.cms_info.content}}>div>

Please keep in mind that
dangerouslySetInnerHTML  can be dangerous if you do not know what is in the HTML string you are adding, sometimes malicious client side code can be injected via script tags.

Tags : javascript, React,

Views : 234

Recent Posts


Popular Tags


Subscribe Us

Follow Us