SamKirklandWA SamKirklandWA - 5 months ago 25
React JSX Question

React: text in state rendered as it is

I have a react code and I want to render state as

. It is rendered, but not as expected. Here's the state:

constructor(props) {
this.state = {text: "<i>Hello, this is Introduction</i>"};

This is rendered as:

<i>Hello, this is Introduction</i>

Is there a way to render it as

Hello, this is Introduction


One of many ways to do it is to put text in state like this:

this.state = {text: "Hello, this is Introduction"};

and render the state's text using italic this