Next.js Developer interview question · Most asked
How do `getServerSideProps`, `getStaticProps` and `getStaticPaths` work in the Pages Router?
Summary
getServerSideProps runs on every request and passes props to the page (SSR); getStaticProps runs at build time (with optional revalidate for ISR); getStaticPaths lists dynamic paths to pre-render, with fallback controlling unknown paths.
Longer Answer
fallback: false 404s unknown paths, true serves a fallback UI then renders, and 'blocking' renders on first request like SSR, then caches. These functions only run on the server, so they can access secrets. In the App Router, async Server Components replace them.
Key Points
getServerSideProps: per requestgetStaticProps+revalidate: SSG/ISRgetStaticPaths+fallbackmodes- Replaced by async Server Components in App Router
More most-asked Next.js Developer questions
- How does data fetching work in the App Router?
- How did caching defaults change in Next.js 15?
- What happens, step by step, when a request reaches a Next.js App Router application?
- What is Next.js and what problems does it solve on top of React?
- What are the differences between the App Router and the Pages Router?
- What is the difference between Server Components and Client Components?
- Explain the App Router file conventions: page, layout, loading, error, not-found, template and route.
- Explain SSR, SSG, ISR and CSR in Next.js.