Ability to create a dynamic email/route #1812
multivoltage
started this conversation in
Ideas
Replies: 1 comment 6 replies
-
I don't think it would be in the scope for React Email, and the same can probably be done with props and through another simpler path. Another thing is that React Email is not NextJS, we just use it for the preview server app but your emails are very separate from it. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Background
Since react-mail is developer under next js, and since next js allows to create dynamic routes, this functionality can solve a lot problem like:
Write [lang].tsx intead create N mail files for each language
Now: => create and duplicate files for each language
After: => create a single [lang].tsx where inside there is a method like
generateStaticParams()
1. Write a [slug].tsx instead create N mail files for each slug
Maybe I have 4 "hot" product coming from a list of 100. And each month this 4 products changes. The developer can fetch with an api
async getHotProducts()
insidegenerateStaticParams()
Proposal
To follow dynamic next routes can be a good solution.
I did not search in code but since there is
PreviewProps
a logic can be added to searchgenerateStaticParams()
.Even if I linked next docs, this new behavior don't want to follow the "cache" behavior of next framework.
Beta Was this translation helpful? Give feedback.
All reactions