Here is my code.
export default class Notes extends Component {
constructor() {
this.state = {
note: null
}
}
componentDidMount() {
this.getNote();
}
getNote() {
axios.get("/api/get-note")
.then(response => {
this.setState({note: response.data.note});
})
.catch(err => {
console.log(err);
});
}
render() {
return (
<div>
<pre>{this.state.note}</pre>
</div>
)
}
}
Let's say the returned value is "<h1>Heading Text</h1>"
. I want it to show H1 heading text. But it doesn't show formatted text. it shows plain text <h1>Heading Text</h1>
.
How can I display formatted text instead of plain text?