Reputation: 11837
Lets say I have an ecommerce site.
Most, if not all of the APIS live on another server.
come back at a later time.
What I am confused about is how this can be done sitewide and work with prerendering etc.. I AM NEW TO NEXTJS.
Write now, on my current site, I am just calling the session api. presaturating the redux and then display the page. Standard stuff. curious how this would work with Next and prerendeirng/static generations etc...
Upvotes: 0
Views: 112
Reputation: 711
Static generations are only available for data that exists at build-time which in this case would exist on request time - therefore you can only achieve pre-rendering via SSR.
From the official documentation:
“You should use getServerSideProps only if you need to pre-render a page whose data must be fetched at request time.”
https://nextjs.org/learn/basics/data-fetching/request-time
Upvotes: 1