react-html-parser-ultimate

A utility for converting HTML strings into React components

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-html-parser-ultimate
1.0.74 years ago4 years agoMinified + gzip package size for react-html-parser-ultimate in KB

Readme

Build Status
react-html-parser-ultimate
A utility for converting HTML strings into React components

Installation

npm i react-html-parser-ultimate
or
yarn add react-html-parser-ultimate

Usage

import { parseHtml } from 'react-html-parser-ultimate';

parseHtml(html, {
    onTransform: (node, index, nodeToElementFn) => {
        if (node.name === 'div') {
            node.name = 'span';
            return nodeToElementFn(node, index);
        }
        return undefined;
    },
    allowScript: true,
});