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
27 lines (24 loc) · 630 Bytes
/
App.tsx
File metadata and controls
27 lines (24 loc) · 630 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
import React from 'react';
import parse, { domToReact, htmlToDOM, Element } from 'html-react-parser';
import './App.css';
console.log(domToReact);
console.log(htmlToDOM);
const parser = (input: string) =>
parse(input, {
replace: domNode => {
if (domNode instanceof Element && domNode.attribs.class === 'remove') {
return <></>;
}
}
});
export default function App() {
return (
<div className="App">
{parser(`
<h2 style="font-family: 'Lucida Grande';">
HTMLReactParser<br class="remove"> loaded withCreate React App
</h2>
`)}
</div>
);
}