You can still use meteorhacks:ssr. Use html files in your /private folder. From your react template you can pass data to your email method, and then from the method into the html template via SSR.render.
Anyway you can not render React to HTML like you do it on the Client. It is not an MDG or Meteor antipattern. React server-side rendering is pretty nice but do not mind that it so simle (even with non-Meteor backend)
This is absolutely false. ReactDOMServer.renderToStaticMarkup allows you to render any React component to static HTML. I use it for sending emails within my application and it works great.
I mean not the techics. React can render on the server really fine (And Blaze also too). It is more about we should think about data and not to use client-side ui components as we do it on the Client
Thats not polite. Dont you think that people here know about React (in context that it nice for server side rendering). It is friendly to ask for details or just “What you mean …?”
The OP was asking about sending emails using React components. I admit that I could have worded my response more nicely, but using ReactDOMServer.renderToStaticMarkup is how you render React on the server when you want to send static HTML like an email.
There’s no anti-pattern here. You’re creating static HTML for emails with variables. IMO the simplest thing to do is to use a stateless, functional React component and simply render the HTML and add it to the email.
Your answer didn’t offer any suggestions of what the OP should do where I am giving him clear guidance to solve his problem.
He’s not really talking about “server-side rendering” - this term is typically reserved for pre-rending a page on the server before sending it to the client to become a live, updatable page. Sending an email doesn’t work like that. It’s all static HTML.
For your emails, do you send them as unstyled-html or you do know of a nice way to inline the styles before/after using ReactDOMServer.renderToStaticMarkup?
To be honest most of the emails I send as React components are simple reports because HTML emails are awful. For me the most part if I need a more complex email I’ll create something in Mailchimp because it saves me a ton of time and I don’t have to test my email to make sure it works across all kinds of different mail clients.