4.1.3 • Published 2 months ago

react-parse-htmlstring v4.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

ReactParseHTMLString

Parse any string and return a React component on a html container of your choice!

Try the Live Demo!

Install

npm install react-parse-htmlstring
# or
yarn add react-parse-htmlstring

Usage

import React from 'react';
import ParseHTML, { parseHTMLString } from 'react-parse-htmlstring';

function HtmlComponent() {
	const htmlString = 'Even with x<y <i>I am still <strong>Strong!</strong></i>';
	return <ParseHTML
		string={ htmlString }
		className="demo"
		style={ { padding: '0.5rem', borderRadius: '1px solid gainsboro' } }
	/>;
}

API

component <ParseHTML />

Takes a few props and returns equivalent React element

Usage

import ParseHTML from 'react-parse-htmlstring';

props

  • string: Any string you need parsing!
  • className: CSS classname/s you can attach to style the component
  • style: If you prefer inline styling to above className... or use them both!
    • { borderRadius: '1px solid gainsboro' }: For example.
  • wrapperElement: Any html container element.
    • div: As default when none is provided.

function parseHTMLString

Takes any string and returns a parsed and safe HTML string if you're just like me that has some situations where the dangerouslySetInnerHTML has to be used .

Usage

import { parseHTMLString } from 'react-parse-htmlstring';

argument

  • string: Any string you need parsing!
4.1.3

2 months ago

4.1.0

2 months ago

4.0.1

2 years ago

4.0.0

2 years ago

3.0.20

2 years ago

3.0.19

2 years ago

3.0.17

2 years ago

3.0.18

2 years ago

3.0.16

2 years ago

3.0.15

2 years ago

3.0.14

2 years ago

3.0.13

2 years ago

3.0.12

2 years ago

3.0.11

2 years ago

3.0.10

2 years ago

3.0.9

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.5

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.27

2 years ago

2.1.26

2 years ago

2.1.25

2 years ago

2.1.24

2 years ago

2.1.23

2 years ago

2.1.22

2 years ago

2.1.21

2 years ago

2.1.20

2 years ago

2.1.19

2 years ago

2.1.18

2 years ago

2.1.17

2 years ago

2.1.16

2 years ago

2.1.15

2 years ago

2.1.14

2 years ago

2.1.13

2 years ago

2.1.12

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago