0

I have a html as a string. In my code I substring it and it my code I get something like:

<div>loremlalal..<p>dsdM</p> - that's all

How can I parse the html so I get the correct output?

Maybe you know some packages I can use.

I saw one answer here on stackoverflow and it used document object but since I use next.js I will be having problem with it.

Rostyk
  • 939
  • 3
  • 13
  • 32

1 Answers1

0

You can bind to dom directly like this way.

<div dangerouslySetInnerHTML={{__html: '<h1>Hello world..</h1>'}}></div>
AwaisHassan
  • 74
  • 1
  • 10