SSG without fetch on server components #63668
Unanswered
Emonee
asked this question in
App Router
Replies: 1 comment 1 reply
-
Could you try using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all!
I have been fighting on understand the new way of doing SSG. In the docs says that you just use the
fetch
function, that already has the default{ cache: 'force-cache' }
and that data will be statically generated in the server at build time. All fine and good to this points, but.What happens when I want to generate static data that doesn't come from a
fetch
function and comes from other types of async functions, like a db query?When I do stuff like this, the someData variable is generated on each user demand and I don't see any way to generate that just in build time.
Am I just missing something? I love Next and the way of fetching data inside a component like this is just great, but i think is a back step to do SSG only with the fetch method where you are forced to consult an API.
Any answer are welcome! Thanks!
Beta Was this translation helpful? Give feedback.
All reactions