Say I have the following code in my database (user input):
<html>
<title>Test</title>
<body>testing website</body>
</html>
And I fetched it correctly from my database using ReactJS. How can I display this in say: 'localhost:3000/play'? I don't want it to be rendered as raw data just like the code but I want it to actually render the html body as a website. (Title set to Test, and displays a small text: testing website). How can I do that in ReactJS? I already have /play configured and I just want to know how to display it there in the index.js file. I tried something like <div dangerouslySetInnerHTML={template} /> but it didn't work.
templateis a json in form of{__html: 'First · Second'}. the__htmlattribute is important.const innerHtml = { __html: snapshot.val() } return(<div dangerouslySetInnerHTML={innerHtml} />)and when I log innerHtml I get this{__html: "<html> <title>Test</title> <body>testing website</body> </html>"}