dangerouslysetinnerhtml reactjs code example
Example 1: dangerouslySetInnerHTML
<div
dangerouslySetInnerHTML={{
__html: '<p>test</p>'
}}></div>
Example 2: dangerouslySetInnerHTML
function createMarkup() {
return {
__html: 'First · Second' };
};
<div dangerouslySetInnerHTML={createMarkup()} />
Example 3: dangerouslysetinnerhtml
function App(){return(<div dangerouslySetInnerHTML={{ __html: `This text is set using dangerouslySetInnerHTML` }}> </div>) }ReactDOM.render(<App />, document.querySelector("#root"));