I need to send an email of my rendered ReactJS component, for that, I need to convert my React component in HTML and send the email. I know how to send HTML through the mail, but getting stuck in how to get HTML from the ReactJS component.
You can use renderToString of react-dom/server and use it like
import ReactDOMServer from 'react-dom/server'
const htmlString = ReactDOMServer.renderToString(<App />)
ReactDOMServer is used for SSR (Server Side Rendering) of react components.
renderToString converts your React component to string. So, You will get string html from JSX of your component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With