I have a div
in the render()
function like below where output is a custom object
{output.text.split("-").map(res =>
<div>{res}</div>
)}
Now the res
string may or may not have HTML elements. If it has html elements, it should be displayed accordingly in UI
For ex: if value of res
is Please click the link <a href="url">here</a>
, it should be displayed in the UI as below,
Please click the link here
2
Answers
You can try using the
DOMParser
like this:For any more quires kindly do let me know.
Thank you.
You can use html-react-parser library to meet you requirements.