Next.js 12's getServerSideProps forced all data fetching upfront at the page root and pushed huge nested props down through every component. Moving to Next.js 14 and React 18 lets components fetch their own data, memoizes repeated calls with cache(), supports parallel fetches and Suspense streaming, and avoids rewriting an entire app in one big risky PR.

A staged migration plan

1. Upgrade to Next.js 13, then 14 (staying on Pages Router)

Clear breaking changes first while keeping existing routes and rendering working as before. Walk through the Next.js Server Components & Actions security guide while upgrading.

2. Move to the App Router incrementally

  • Move root page fetching into an initial "use client" root component first so routes migrate without rewriting prop drilling all at once.
  • Replace manual <head> tags with the Metadata API (generateMetadata or static metadata).
  • HTTP cannot set cookies once streaming starts, so cookie writes move to Middleware, Route Handlers, or Server Actions (set NEXT_SERVER_ACTIONS_ENCRYPTION_KEY if you rotate keys across multiple instances).
  • Add explicit cache options to fetch() calls and verify streaming works through your reverse proxy.

3. Add a Data Access Layer (DAL) and DTO layer

  • Put each query, fetch function, preload helper, and test fixture in its own server-only module wrapped in React cache().
  • Put a thin DTO layer in front of components so defaults, sorting, and derived fields happen once on the server instead of inside JSX.

4. Push "use client" down the tree

  • Replace root prop drilling with component-level DTO calls and wrap slow sections in <Suspense> boundaries.
  • Pass Server Component subtrees as children props into Client wrappers when an interactive shell needs to wrap server-rendered content.

The styled-components catch

Runtime CSS-in-JS libraries like styled-components depend on React Context, which Server Components do not support. They still work in SSR Client Components (with a style-registry workaround), though longer-term moving toward CSS Modules or Tailwind lets you use Server Components directly without shipping a CSS-in-JS runtime.