I receive html as a string from a CMS.
What I want to achieve, is replacing some of this content, with a React component
Example could be
const html = "<div class="example"><h1 class="title>Title</h1></div>"
Everytime the HTML string has the class "title" included, I want to replace the h1 element with <Title />
Example of component
const Title = () => {
const [clicked, setClicked] = React.useState(false)
return <h1 onClick={() => setClicked(!clicked)} style={clicked ? {color: 'red'} : {color: 'blue'}>Title</h1>
Is this even possible?