Convert String to HTML on React , rich text editor

Viewed 4107

I am using React-Quill to add Rich text editor to my app.

have the next string store in my DB:

const text = '<p>Hello<strong> World</strong></p><p><strong>Next Line</strong></p>';

Now I want to "Render" the text const in a REACT component, but with the "Styuling" that HTML gives to it.

Hello World

Next Line

How can I do it? or other rich text editor to achieve that?

3 Answers

react-quill supports HTML strings out of the box, so there's nothing to do except set the value property of the component with the string you receive from the database.

<ReactQuill value={text} ... />
Related