Pages data functions vs async Server Components.
Skip to solutionKEEP THE
mediumFrontend
What is the difference between getServerSideProps/getStaticProps and App Router data fetching?
968 views
01
Understand the problem
nextjsgetserversidepropsgetstaticpropsdata-fetching
02
Attempt it yourself
Sketch your approach before reading the solution — that's what interviews test.
Nudge consolestandby
Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.
03
Study the solution
In the Pages Router, getStaticProps (build-time) and getServerSideProps (per-request) fetch data and pass props to a page. The App Router replaces both with async Server Components that fetch directly, using fetch caching/revalidate to choose static vs dynamic per call — more granular and colocated.
Solution ready — 2 min read
Classified // press E to declassify
04
Read the code
SSR page, both routers
// Pages Router
export async function getServerSideProps() {
return { props: { data: await getData() } };
}
export default function Page({ data }) { /* ... */ }
// App Router — inline, dynamic via no-store
export default async function Page() {
const data = await fetch('https://api/data', { cache: 'no-store' }).then(r => r.json());
return /* ... */;
}05
Join the discussion
Discussion (0)
Sign in to join the discussion.
No responses yet. Be the first to share what you think.
Transmission complete // awaiting log
KEEP THE
STREAK ALIVE.
Dossier 24 of 95 decoded in the Next.js track. One more won't hurt.