How to use the html-react-parser/lib/dom-to-react function in html-react-parser

To help you get started, we’ve selected a few html-react-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anchorchat / anchor-ui / src / message / text-message / index.jsx View on Github external
replace: (domNode) => {
        if (domNode.attribs && domNode.attribs.class === 'highlight') {
          const value = find(highlights, { id: domNode.attribs.value });

          return (
            <strong style="{getStyles.mention(color,"> onHighlightClick(e, value)}
            &gt;
              {domToReact(domNode.children)}
            </strong>
          );
        }

        if (domNode.attribs &amp;&amp; domNode.attribs.class === 'link') {
          const { value } = domNode.attribs;

          return (
            <a rel="noopener noreferrer" href="{value}" style="{styles.link}">
              {domToReact(domNode.children)}
            </a>
          );
        }

        return domNode;
      }

html-react-parser

HTML to React parser.

MIT
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis