Question presented to candidate: "After upgrading, TypeScript complains that params is a Promise in every page. Why did Next.js make params and searchParams async, and what happens if you still read them synchronously?"
What a strong answer should cover:
- Since Next.js 15,
paramsandsearchParamsin pages, layouts,generateMetadataand Route Handlers are Promises you mustawait(or unwrap withuse()in a client component). - The same release made
cookies(),headers()anddraftMode()async. - The reason: Next.js can start rendering (and prerender the parts that do not need request data) before the request-specific values are resolved, which is what enables streaming and PPR.
- Next.js 15 kept a temporary synchronous fallback with a warning; in 16 synchronous access is gone and reading a property of the Promise gives
undefined. - A codemod (
next-async-request-api) rewrites most code automatically.
Clarifying questions expected:
- "Is this a Server or Client Component?" — await in server code,
use()in client code, oruseParams()from next/navigation. - "Which Next version are you upgrading to?" — 16 has no sync fallback.
Code / implementation expected: Yes — the async signature in a page and in a client component.