Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README example are incorrect #222

Open
MatthewHerbst opened this issue May 30, 2024 · 0 comments
Open

README example are incorrect #222

MatthewHerbst opened this issue May 30, 2024 · 0 comments

Comments

@MatthewHerbst
Copy link

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant