hedgedoc / html-to-react

GNU Affero General Public License v3.0
10 stars 5 forks source link

Issuw while installing the package #28

Closed priyadarshiniMuthuraman closed 2 years ago

priyadarshiniMuthuraman commented 2 years ago

My react version is 17.0.2 but I am unable to install the react-html-parser, getting the error has below. Kindly guide on this.

image
mrdrogdrog commented 2 years ago

Hi, react-html-parser is the npm package of the original version of this lib that is hosted here: https://github.com/peternewnham/react-html-parser .

THIS repo is a hard fork that we created because we use the lib in your project and needed a maintained version. It is available on npm under @hedgedoc/html-to-react. Sorry for the wrong package name in the README :sweat_smile: . I just updated it.

priyadarshiniMuthuraman commented 2 years ago

@mrdrogdrog Thank you your swift update It worked. You need to change the usage part in Readme file

Usage

import React from 'react';
import convertHtmlToReact from '@hedgedoc/html-to-react';

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

from ReactHtmlParser(html) to convertHtmlToReact (html, true);

Edit by @ErikMichelson: Usage of code blocks for easier reading