forked from mikenikles/html-to-react
-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
The README shows:
const HtmlToReactParser = require('html-to-react').Parser;
const htmlInput = '<div><h1>Title</h1><p>A paragraph</p></div>';
const htmlToReactParser = new HtmlToReactParser();
const reactElement = htmlToReactParser.parse(htmlInput);However, when trying to follow the above I got type errors saying Parser is a function and couldn't be used with new.
This seems to work:
import { Parser } from "html-to-react";
const htmlInput = '<div><h1>Title</h1><p>A paragraph</p></div>';
const htmlToReactParser = Parser();
const reactDescription = htmlToReactParser.parse(htmlInput);justclint, TomRadford and ArrayIterator
Metadata
Metadata
Assignees
Labels
No labels