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