Dhruv Raval
Dhruv Raval

Reputation: 1583

Display proper html content in react. Content is Dynamic from Database

I am building blogging application. and i use summernote for write a blog content. Blog content are stored in database like this :

<b>hi</b>.....<b>share if you like</b>

But when i fetch and try to disply blog content it will display same html code ex:

<b>hi</b>.....<b>share if you like</b> insted of hi ..... share if you like.

Now how to display blog content with all styles?

Snap of table: enter image description here

Snap of html output:

enter image description here

Upvotes: 1

Views: 201

Answers (1)

Triyugi Narayan Mani
Triyugi Narayan Mani

Reputation: 3109

You can use dangerouslySetInnerHTML to render html content.

<div dangerouslySetInnerHTML={{__html: "<p>your html content</p>"}}></div>

Upvotes: 2

Related Questions