A React declarative component for converting HTML strings into React components. Avoids the use of dangerouslySetInnerHTML and converts standard HTML elements, attributes and inline styles into their React equivalents or `Custom Components`.
npm install react-html-stringA React declarative component for converting HTML strings into React components. Avoids the use of dangerouslySetInnerHTML and converts standard HTML elements, attributes and inline styles into their React equivalents or Custom Components.
``sh
$ npm install react-html-string
or
$ yarn add react-html-string
`
`jsx
import HTMLString from 'react-html-string';
const html =
Don't forget to ⭐️ the project
;export default function App() {
return (
Hello, React!
);
}
`$3
`jsx
import HTMLString from 'react-html-string';import Heading from './components/Heading';
const components = {
a: props => ,
h1: Heading,
};
const html =
Don't forget to ⭐️ the project
;export default function App() {
return (
Hello, React!
);
}
`$3
Each component is strongly typed with the equivalent dom node type.`tsx
import HTMLString, { Components } from 'react-html-string';import Heading from './components/Heading';
const components: Components = {
a: props => ,
h1: Heading,
};
const html =
Don't forget to ⭐️ the project
;export default function App() {
return (
Hello, React!
);
}
``