HTML을 React 문법인 jsx로 변환해주는 라이브러리이다.
1-1-1. npm
npm install html-react-parser --save
1-1-2. yarn
yarn add html-react-parser
1-1-3. CDN
<!-- HTMLReactParser depends on React -->
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script src="https://unpkg.com/html-react-parser@latest/dist/html-react-parser.min.js"></script>
<script>
window.HTMLReactParser(/* string */);
</script>
const parse = require('html-react-parser');
parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')