Reputation: 2008
I have Next.js with Nodemailer and i want to use React / JSX components as templates in Nodemailer.
Currently in Nodemailer i have to write
html: `
<div style="height: 100%; background-color: blue;">
<div style="color: white;">${req.body.textarea}</div>
<div style="height: 20px; background-color: red;">${req.body.textarea}</div>
</div>
`,
But is there a way to write React / JSX component and pass it to Nodemailer?
Googling i found grandjs
but i think this might be to much for what i need so looking for something simpler.
I guess the idea should be to convert React JSX to plain HTML so i found ReactDOMServer.renderToStaticMarkup
but i can't user that on Server Side
Upvotes: 1
Views: 819
Reputation: 2008
Sorry guys me being dumb, i have this working now with ReactDOMServer.renderToStaticMarkup
Upvotes: 1