How to send a React email in Express with Resend? #1322
-
Hi, in the docs the source code is provided for a file index.jsx which imports and sends an email, but it doesn't say how to run this. Can anyone provide a suggestion and maybe add this to the doc? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Its implicit, your "./email" is going to contain the React component you can use to send the email. |
Beta Was this translation helpful? Give feedback.
-
Awesome, I will give it a go, thank you very much. |
Beta Was this translation helpful? Give feedback.
Yeah, that's the general intent with the email components. React components aren't necessarily tied to the browser or the DOM, so we do the rendering into pure HTML since the React components are basically like a JSON object in the end.
So yes, you can import the React component into your express server as long as you have the types and JSX configured properly. Be aware that it will need a compilation step to use the JSX as well though,
tsc
will do the trick as long as you configure it right, as I mentioned before, but if you are using just plain JavaScript you will need something else.