for example I have the description variable defined as follows in nextjs
description={storeDetail?.translation?.description}
and as output description it shows me this <p>Tenis</p>
,However I would like to display Tenis simply without the Html tags.
thank you for helping me!
2
Answers
You can achieve this by creating a dummy HTML div using createElement method and then just fetch the innerText of that div and update the value of your variable
For Example
The simplest way to do this is to use
dangerouslySetInnerHTML
Otherwise, there are libraries you can use. A good example is
react-html-parser