Skip to content

Latest commit

History

History
24 lines (17 loc) Β· 476 Bytes

File metadata and controls

24 lines (17 loc) Β· 476 Bytes

How to parse an HTML page with React

You can use the node-html-parser npm package:

import{parse}from'node-html-parser';functionApp(){constroot=parse('<ul id="list"><li>Hello World</li></ul>');consttext=root.querySelector('#list li').innerText;return(<div>{text}</div>);}exportdefaultApp;

References: