Convert HTML Strings Into Components – React HTML Parser

The React HTML Parser converts HTML strings directly into React components. Avoids the use of dangerouslySetInnerHTML and converts standard HTML elements, attributes and inline styles into their React equivalents.


# Yarn
$ yarn add react-html-parser

$ npm install react-html-parser --save


import React from 'react';
import ReactHtmlParser, { processNodes, convertNodeToElement, htmlparser2 } from 'react-html-parser';

class HtmlComponent extends React.Component {
  render() {
    const html = '<div>HTML strings</div>';
    return <div>{ ReactHtmlParser(html) }</div>;


React HTML Parser

Download Details:

Author: wrakky

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website:

License: MIT

You Might Be Interested In:

Add Comment