metronic 9 - how to vite configure to render static html files from react js
Hi,
As the subject, need help in configuring vite so it can build into static html files.
Thanks,
Vikas
Replies (1)
Hi Vikas,
Sorry for the late reply.
You can convert your HTML code to tsx using <a href="https://transform.tools/html-to-jsx">this converter</a> and then render the tsx components, the alternative solution for rendering the static HTML is to use <strong>dangerouslySetInnerHTML</strong>.
<pre> import DOMPurify from "dompurify"; const myHTML = `<h1>John Doe</h1>`; const mySafeHTML = DOMPurify.sanitize(myHTML); const App = () => <div dangerouslySetInnerHTML={{ __html: mySafeHTML }} />; </pre>Regards, Lauris Stepanovs, Keenthemes Support Team