Rendering strategies · mid
Pages Router: getServerSideProps, getStaticProps and migrating
Interviewers still ask Pages Router data functions: getServerSideProps runs on every request, getStaticProps at build (plus revalidate for ISR), getStaticPaths lists dynamic pages with a fallback mode; know how each maps to the App Router and how to migrate route by route.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
getServerSideProps({ params, query, req, res })runs on the server for every request and returns{ props },{ redirect }or{ notFound: true }. App Router: an async Server Component reading request data (dynamic rendering).getStaticPropsruns at build;revalidate: 60makes it ISR. App Router: cached data ("use cache"+cacheLifewith Cache Components, orfetch(url, { next: { revalidate: 60 } })/cache: "force-cache"in the previous model).getStaticPathsreturnspathsandfallback:false(404 for others),true(fallback UI, then generate),"blocking"(wait for SSR). App Router:generateStaticParams+dynamicParams; with Cache Components,fallback: truemaps to Partial Prefetching (App Shell first) and"blocking"to awaiting params outside Suspense._appand_documentbecome the rootlayout.tsx;next/headbecomes the Metadata API;pages/api/*becomesroute.tsRoute Handlers;next/routerbecomesnext/navigationhooks (noquery, noasPath, noisFallback);_error/404becomeerror.tsx/not-found.tsx.- Pages are Client Components in
pages/; inapp/they are Server Components by default. - Incremental migration: both routers coexist; move leaf routes first; navigation between the two routers is a hard navigation; keep
_app/_documentuntil done. - The Pages Router is still supported, but Cache Components, Partial Prerendering and Server Actions are App Router only.
- Careful: Next 15+
fetchis NOT cached by default, even though some older migration examples say it defaults toforce-cache.
The red pen
Common traps: mistake → fix
Mistake: "getServerSideProps runs in the browser on client navigation"
Fix: it always runs on the server; the client fetches its JSON.
Mistake: "
fallback: trueandblockingare the same"Fix:
trueshows a fallback first;blockingwaits for the full HTML.Mistake: "Migrate everything in one big PR"
Fix: migrate route by route.
Easy to hard
Questions interviewers ask, easy to hard
- Explain
getStaticProps,getServerSidePropsandgetStaticPaths. - What does each
fallbackvalue do? - What replaced them in the App Router?
- We have a large Pages Router app. Would you migrate, and how?
- What happens when a user navigates between an App Router page and a Pages Router page?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.