yarn add html-react-parser
import React from 'react';
import ReactHtmlParser, { processNodes, convertNodeToElement, htmlparser2 } from 'react-html-parser';
class HtmlComponent extends React.Component {
render() {
const html = '<div>Example HTML string</div>';
return <div>{ ReactHtmlParser(html) }</div>;
}
}
import React from 'react';function transform(node) { if (node.type === 'tag' && node.name === 'b') { return <div>This was a bold tag</div>; }}