AI
prepair.app
Start interview →
EnglishРусскийУкраїнська

Senior Next.jsNext.js interview questions

Senior · 5+ years of experience

Next.js interviews centre on rendering strategies, the App Router, server components, and caching — the parts that separate Next from plain React. Below are the most common questions with model answers. Senior: architecture, trade-offs, mentoring, and decision-making.

Topics to prepare

SSR, SSG, ISR and CSR
App Router vs Pages Router
Server components
Route handlers and API
Caching and revalidation
Image and font optimization

6 Senior-level questions with answers

1

Why is the "use client" directive needed?

Answer

In the App Router every component is a server component by default; "use client" marks the boundary where the client bundle begins. Everything imported below that boundary is shipped to the browser, which is why placing it at the top of a layout accidentally makes the whole subtree client-side. Without it, calling useState or attaching an onClick handler throws at build time.

2

How does caching work in the App Router? What is revalidate?

Answer

Next caches on several layers: the fetch result cache, the full route cache for rendered output, and the client router cache for navigations. revalidate sets how long a cached entry stays fresh, either per fetch or exported from the route segment. For event-driven updates you call revalidatePath or revalidateTag after a mutation, which is more precise than a time window.

3

What are Server Actions and when do you use them?

Answer

A Server Action is an async function marked "use server" that a client component can call directly, with Next handling serialisation and the network round trip. It replaces writing an API route for simple mutations such as form submissions, and it composes with revalidatePath to refresh data afterwards. Because it is a public endpoint under the hood, it must still validate input and check authorization.

4

How does next/image optimize images?

Answer

It generates responsive variants in modern formats such as WebP and AVIF, serves the size that matches the viewport, lazy-loads by default, and reserves layout space so the page does not shift. Requiring explicit width and height or the fill prop is what eliminates cumulative layout shift. The result is usually the single largest Core Web Vitals improvement in a Next app.

5

What are streaming and Suspense in Next.js?

Answer

Streaming sends HTML to the browser in chunks as it becomes ready instead of waiting for the slowest data source. Wrapping a slow component in Suspense with a fallback lets the rest of the page render immediately while that section arrives later. Practically this means a slow product-recommendations widget no longer delays the whole page, which improves perceived performance and time to first byte.

6

How do you implement dynamic metadata for SEO?

Answer

Export generateMetadata from a page or layout — it receives the route params, can await data, and returns title, description, canonical, and Open Graph fields. For static pages the simpler metadata export is enough. Add an opengraph-image file in the route folder and Next generates the social preview image for that route automatically.

🦎

Reading answers is not enough

In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.

Practice a Senior Next.js interview →
Free · 3 interviews per month

Other levels — Next.js

Junior Next.jsMiddle Next.jsAll Next.js questions

Other specializations

🔍Senior Manual QA🤖Senior QA AutomationSenior Java Backend🐍Senior Python Backend🐘Senior PHP Backend🦫Senior Go Backend🟢Senior Node.js Backend⚛️Senior React Frontend💚Senior Vue Frontend🅰️Senior Angular Frontend