How to Render Html Tags from a Database in React
In this lesson, we are going to see how to render HTML tags from a database in react js, we will use a package called html-to-react.
Install the package
First, let's install the package.
npm i html-to-react
Render html tags
Next, to render the HTML tags use the code below:
import React from 'react';
import { Parser } from 'html-to-react';
export default function Home() {
return (
<div>
{
Parser().parse('<h4 className="my-3">Home Page</h4>')
}
</div>
)
}