- Forums
- react
- How to Render or Parse or Convert Text into HTML in a React Component JSX Code
This Page Contains information about How to Render or Parse or Convert Text into HTML in a React Component JSX Code By dd in category react with 0 Replies. [5109], Last Updated: Mon Jun 24, 2024
dd
Sat Mar 25, 2023
0 Comments
270 Visits
To covert a string of text into HTML there many ways you can do this, this is how I do it in three simple steps:
1. install html-react-parser
$ npm i html-react-parser
2. import html-react-parser
import parse from 'html-react-parser'
3. add to jsx code
body: "<h1>BODY Header</h1><p>This is the paragraph of the body.</p>",
<Modal.Body>{parse(modalContent.body)}</Modal.Body>