You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-11Lines changed: 24 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# htmlstring-to-react
2
2
3
+
## Why ?
4
+
5
+
This module provide an easy way to parse a string containing html elements to an array of React elements. It tries to focus to security (using [DOMPurify](https://github.com/cure53/DOMPurify)) and keeping the bundle as small as possible
6
+
7
+
It is heavily inspired by [html2react](https://github.com/Deschtex/html2react) and [html-react-parser](https://github.com/remarkablemark/html-react-parser)
8
+
3
9
## How to install ?
4
10
5
11
npm install htmlstring-to-react
@@ -13,30 +19,37 @@
13
19
import { parse } from 'htmlstring-to-react'
14
20
parse('<em key="1"><b key="2">It\' is working</b></em>')
15
21
16
-
### Add an event handler
22
+
### Add an override
17
23
18
-
Add an evant handler on all `b` elements
24
+
You can use css selectors to override an element
19
25
20
26
import { parse } from 'htmlstring-to-react'
21
27
parse('<b key="1">It</b> is <b key="2">working</b>', {
0 commit comments