Migrate from next 12 to next 14 and cant find the approach to replace getStaticProps with App router #67600
Replies: 1 comment 2 replies
-
|
When using APP routing, the concepts of CSR, SSR, SSG and ISR may be a little vague: There are three different server-side rendering strategies in the APP router: Static rendering Static Rendering is used by default, which is either rendered at build time or in the background after revalidation, so you just need to convert your getStaticProps script to a server-side component to default to static rendering. If dynamic functions or uncached data requests are used, Next.js switches to dynamic rendering In Next.js these dynamic functions are: cookies() and headers() : Gets cookies and headers You can verify this at build time |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As I have in next 12 projects getStaticProps it doesn't fetch data from any API, instead, it reads data from files and merges and combines data in a desired format. for an example:
this is just a demo what logic builds inside the getStaticProps (please avoid validate the code), and gets all this desired data at build time.
so how this possible with next 14 with App router, where I do not want to re generate this logic on every request.
I will be very grateful for the answer :)
Beta Was this translation helpful? Give feedback.
All reactions