I have some strings stored in Firestore as:
item1: {
content: '<p>Hi</p>'
}
item2: {
content: '<p>Hi 2</p>'
}
When I use the following render function in my React component, it is printing out the paragraph tags (and any other HTML):
render() {
const { items } = this.state
this.items = items.map(function(item, key) {
<li key={key}>{item['content']}</li>
})
return (
<ul>
{this.items}
</ul>
)
}
How to fix? Any way to do this without dangerouslySetInnerHtml?