forked from remarkablemark/html-react-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
29 lines (27 loc) · 650 Bytes
/
App.tsx
File metadata and controls
29 lines (27 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import parse, { domToReact, htmlToDOM, Element } from 'html-react-parser';
import './App.css';
console.log(domToReact);
console.log(htmlToDOM);
export default function App() {
return (
<div className="App">
{parse(
`
<h1 style="font-family: 'Lucida Grande';">
HTMLReactParser<br class="remove"> with Create React App (TypeScript)
</h1>
`,
{
replace(domNode) {
if (
domNode instanceof Element &&
domNode.attribs.class === 'remove'
) {
return <></>;
}
},
}
)}
</div>
);
}