Skip to content
Resume Studioby M2Toolkit

23 role-specific questions

Next.js Developer Interview Questions & Answers

Next.js roles test whether you can choose the right rendering strategy for each page, split work between Server and Client Components, and reason about caching, data fetching and authentication in a full-stack React framework.

Free, no sign-up. 110 questions in this role's practice pool, including behavioural, HR and situational questions.

Next.js interview questions

The App Router, Server and Client Components, rendering strategies, caching, route handlers and middleware.

  1. 1.

    Explain Server Components and Client Components in the Next.js App Router. How do you decide which to use?

    IntermediateTechnical

    What the interviewer is evaluating

    Whether you can split an app sensibly between server and client.

    Key points a strong answer covers

    • Server by default. In the App Router, components are Server Components by default.
    • 'use client' boundary. 'use client' marks the entry to client code; everything it imports becomes client code.
    • When client. Use Client Components for state, effects, event handlers and browser APIs.
    • Keep client islands small. Push 'use client' to the leaves and pass Server Components as children.
    • Serialisable props. Props crossing the boundary must be serialisable — no functions (except Server Actions).

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Adding 'use client' to the root layout.
    • Importing server-only code (secrets, DB clients) into a client file.

    Likely follow-up questions

    • How can a Client Component render a Server Component?
    • What does the server-only package protect against?
    Example strong answer

    In the App Router everything is a Server Component unless a file starts with 'use client'. Server Components render on the server, can be async, fetch data directly and ship no JavaScript. I switch to a Client Component only when I need state, effects, event handlers or browser APIs — a search box, a modal, a chart. The directive marks a boundary: that file and everything it imports goes to the client, so I push it as far down as possible — a page stays a Server Component and renders a small <AddToCartButton> client island. A Client Component can still show server-rendered content passed as children. Props across the boundary must be serialisable, and I guard server code with the server-only package.

    Practise this question and get feedback
  2. 2.

    How does server-side rendering work, and what is hydration?

    BeginnerTechnical

    What the interviewer is evaluating

    Fundamentals behind performance and hydration bugs.

    Key points a strong answer covers

    • HTML rendered on the server. The server renders the page to HTML so the user sees content before JavaScript loads.
    • Hydration. In the browser React hydrates: attaches event handlers to the existing HTML to make it interactive.
    • Benefits. Better first paint and crawlable content.
    • Hydration mismatch. Server and client output must match — dates, random values and window checks cause mismatches.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Thinking SSR means the page needs no JavaScript.
    • Reading window during render, causing mismatches.

    Likely follow-up questions

    • How would you fix a hydration mismatch caused by a timestamp?
    • What is streaming SSR?
    Example strong answer

    With SSR the server runs the React components for a request and sends complete HTML, so the browser can show content immediately and crawlers see real text. Then the JavaScript loads and React hydrates the page: it walks the existing HTML and attaches event handlers and state, making it interactive rather than re-creating the DOM. For that to work the first client render has to produce the same output as the server. Hydration mismatches usually come from things like new Date(), random IDs, locale formatting or checking window during render; I move those into an effect, use useId, or format on the server. With the App Router, Suspense also lets the server stream HTML in chunks.

    Practise this question and get feedback
  3. 3.

    Explain static generation, dynamic rendering and incremental static regeneration (ISR).

    IntermediateTechnical

    What the interviewer is evaluating

    Choosing a rendering strategy per page.

    Key points a strong answer covers

    • Static at build. Static pages are rendered at build time and served from a CDN.
    • Dynamic per request. Dynamic rendering runs per request — needed for cookies, headers or personalised data.
    • ISR / revalidate. ISR serves a cached page and regenerates it in the background after a time or on demand.
    • Choosing. Choose by how fresh and how personalised the data must be.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Making every page dynamic by reading cookies in the root layout.
    • Not knowing on-demand revalidation exists.

    Likely follow-up questions

    • What makes a route dynamic automatically?
    • How would you update a product page instantly after an edit in the CMS?
    Example strong answer

    Static generation renders a page at build time, so it's just a file on the CDN — fastest and cheapest, ideal for marketing pages and blog posts; generateStaticParams pre-builds dynamic routes like /blog/[slug]. Dynamic rendering runs on every request, which you need when the output depends on cookies, headers or search params — a dashboard, for instance. Reading those APIs opts a route into dynamic rendering. ISR sits in between: the page is served from cache and regenerated in the background after a revalidate period, or on demand with revalidatePath or revalidateTag — so a CMS webhook can refresh a product page the moment it's edited. I choose per route based on freshness and personalisation.

    Practise this question and get feedback
  4. 4.

    How do you handle caching in Next.js?

    AdvancedTechnical

    What the interviewer is evaluating

    Understanding of the different cache layers and how to invalidate them.

    Key points a strong answer covers

    • Multiple layers. There are several layers: request memoisation, data cache, full route cache, client router cache, plus the CDN.
    • fetch / cache options. fetch options or segment config control caching; defaults have changed between versions, so be explicit.
    • Invalidation. Invalidate with revalidatePath / revalidateTag after mutations.
    • Personalised data. Never cache personalised responses publicly.
    • Verify. Check build output and response headers to verify what's actually cached.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Assuming the defaults without checking the Next.js version.
    • Caching a page that shows the logged-in user's data.

    Likely follow-up questions

    • What's the difference between revalidatePath and revalidateTag?
    • How do you cache a database query that doesn't use fetch?
    Example strong answer

    I think of it as layers: per-request memoisation of identical fetches, the data cache for fetch results, the full route cache for rendered static pages, the client-side router cache, and the CDN in front. Caching defaults have changed between Next.js versions, so I'm explicit: cache: 'force-cache' or next: { revalidate: 3600, tags: ['products'] } for shared data, no-store for anything per user. After a mutation — say a Server Action that updates a product — I call revalidateTag('products') so every page using that data refreshes. For non-fetch data like a DB query I use the framework's cache function with tags. Personalised data is never cached publicly. And I verify with the build output and response headers rather than assuming.

    Practise this question and get feedback
  5. 5.

    Explain route handlers and middleware in Next.js. What would you use each for?

    IntermediateTechnical

    What the interviewer is evaluating

    Server-side building blocks and their limits.

    Key points a strong answer covers

    • Route handlers = API endpoints. Route handlers (app/api/x/route.ts) export GET/POST functions using Web Request/Response.
    • Uses for handlers. Webhooks, endpoints for other clients, OAuth callbacks.
    • Middleware runs before routing. Middleware runs before a request is handled, on matched paths.
    • Uses for middleware. Redirects, rewrites, auth checks, locale detection, headers.
    • Keep middleware light. It runs on every matched request, so keep it fast — no heavy DB work.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using route handlers just to fetch data for your own Server Components.
    • Doing full authorisation only in middleware.

    Likely follow-up questions

    • Why shouldn't middleware be your only authorisation check?
    • When would you use a Server Action instead of a route handler?
    Example strong answer

    Route handlers are the App Router's API endpoints: a route.ts exporting GET, POST and so on, using standard Request and Response objects. I use them for things that need a URL — webhooks from Stripe, OAuth callbacks, or an API consumed by a mobile app. For my own pages I don't need them: Server Components can fetch data directly, and mutations can use Server Actions. Middleware runs before a request reaches a route, on paths chosen by a matcher, so it's good for redirects, rewrites, locale detection, setting headers and a quick check that a session cookie exists. It runs on every matched request, so I keep it light, and I still check permissions where the data is accessed.

    Practise this question and get feedback
  6. 6.

    What are Server Actions, and what do you need to be careful about?

    IntermediateTechnical

    What the interviewer is evaluating

    Safe use of server mutations.

    Key points a strong answer covers

    • Server functions called from the client. Server Actions are async functions marked 'use server' that the client can call, e.g. from a form.
    • Progressive enhancement. They work with <form action> — even before JavaScript loads.
    • Treat as public endpoints. Each action is effectively a public endpoint — validate input and check auth inside it.
    • Revalidate after. Revalidate or redirect after the mutation so the UI updates.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Trusting the input because “only my form calls it”.
    • Forgetting to revalidate, so the page shows stale data.

    Likely follow-up questions

    • How would you show a pending state for a form using a Server Action?
    • How do you return validation errors to the form?
    Example strong answer

    Server Actions are async functions marked 'use server' that run on the server but can be called from the client — most simply as a form's action, which works even before JavaScript loads. They're great for mutations like creating a post: no separate API route, and the action can call revalidatePath or redirect when it's done. The big caution is that each action is effectively a public HTTP endpoint, so I validate the input with a schema and check authentication and authorisation inside the action itself, never relying on the UI. For UX I use useActionState to return validation errors and useFormStatus for the pending state.

    Practise this question and get feedback
  7. 7.

    How does Next.js help with images and fonts, and why does it matter?

    BeginnerTechnical

    What the interviewer is evaluating

    Core Web Vitals awareness.

    Key points a strong answer covers

    • next/image. next/image serves resized, modern-format, lazy-loaded images.
    • Layout shift. Width/height or a fill container reserve space and prevent layout shift.
    • Priority / LCP. Mark the hero image as priority so the LCP image isn't lazy-loaded.
    • next/font. next/font self-hosts fonts with no layout shift from swapping.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Lazy-loading the hero (LCP) image.
    • Using huge original images for thumbnails.

    Likely follow-up questions

    • Which Core Web Vital does the hero image affect most?
    • How does sizes change which image the browser downloads?
    Example strong answer

    Images are usually the biggest bytes on a page and the LCP element, so next/image matters: it serves resized images in modern formats like WebP or AVIF, lazy-loads below-the-fold images, and requires dimensions or a sized container so space is reserved and there's no layout shift. The sizes attribute tells the browser which width to fetch on each screen. For the hero image I set priority loading so it isn't lazy-loaded. next/font downloads fonts at build time and self-hosts them, adjusts fallback metrics to avoid layout shift, and removes a request to a third-party font server — which helps privacy too.

    Practise this question and get feedback
  8. 8.

    How do you handle SEO in a Next.js app?

    BeginnerTechnical

    What the interviewer is evaluating

    Practical SEO for server-rendered React.

    Key points a strong answer covers

    • Metadata API. Use the Metadata API / generateMetadata for titles, descriptions and Open Graph.
    • Rendered HTML. Server or static rendering puts real content in the HTML for crawlers.
    • Canonical / sitemap / robots. Canonical URLs, sitemap.ts and robots.ts.
    • Structured data / performance. JSON-LD structured data, and good Core Web Vitals.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Rendering the main content only on the client.
    • Duplicate titles across pages.

    Likely follow-up questions

    • How would you generate unique metadata for 10,000 product pages?
    • What's a canonical URL for?
    Example strong answer

    Next.js gives a strong base because pages are server- or statically rendered, so the content is in the HTML crawlers receive — I make sure important content isn't only rendered client-side. I set titles, descriptions and Open Graph tags through the Metadata API, using generateMetadata for dynamic pages so each product gets a unique title from its data. I add canonical URLs to avoid duplicates from query strings, generate sitemap.ts and robots.ts, and include JSON-LD structured data where it fits, like Product or Article. Performance matters too, so I watch Core Web Vitals.

    Practise this question and get feedback
  9. 9.

    How would you implement authentication in a Next.js App Router application?

    AdvancedTechnical

    What the interviewer is evaluating

    Security across server, middleware and client.

    Key points a strong answer covers

    • Session storage. Store the session in an httpOnly, Secure, SameSite cookie.
    • Library / provider. Use a proven library or provider rather than rolling your own.
    • Check where data is read. Verify the session where data is accessed: in Server Components, actions and handlers.
    • Middleware for redirects. Middleware can redirect logged-out users early, as an optimisation, not the only check.
    • Authorisation. Check permissions, not just that someone is logged in.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Protecting pages only in middleware or only on the client.
    • Storing tokens in localStorage.

    Likely follow-up questions

    • Why is client-side route protection not enough?
    • How do you protect a Server Action?
    Example strong answer

    I'd use a proven library or provider — Auth.js, Clerk, or similar — rather than writing session handling myself. The session lives in an httpOnly, Secure, SameSite cookie, never in localStorage. Middleware can do a cheap check and redirect signed-out users away from /dashboard, but that's an optimisation; the real check happens where data is read and changed — a small data-access layer that verifies the session and the user's permissions, used by Server Components, Server Actions and route handlers alike. Client-side checks only shape the UI. And I check authorisation, not just authentication: the user must own the invoice they're editing.

    Practise this question and get feedback
  10. 10.

    How do loading.tsx, error.tsx and not-found work in the App Router?

    IntermediateTechnical

    What the interviewer is evaluating

    Knowledge of the App Router file conventions.

    Key points a strong answer covers

    • loading = Suspense boundary. loading.tsx wraps the route segment in a Suspense boundary with that fallback.
    • error = error boundary. error.tsx is a Client Component error boundary for the segment, with a reset function.
    • not-found. Calling notFound() renders the nearest not-found.tsx with a 404.
    • Nesting / layouts. They apply per segment; layouts above stay interactive. global-error covers the root layout.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Not knowing error.tsx must be a Client Component.
    • Expecting error.tsx to catch errors in its own layout.

    Likely follow-up questions

    • Why doesn't error.tsx catch errors thrown in the layout of the same segment?
    • When would you use a manual Suspense boundary instead of loading.tsx?
    Example strong answer

    They're file conventions that wrap each route segment. loading.tsx becomes the fallback of a Suspense boundary around the segment's page, so navigation shows a skeleton instantly while the server streams the content. error.tsx is an error boundary — it must be a Client Component — that catches errors in that segment and receives error and a reset function to retry; the layouts above it stay interactive. Because it sits inside the segment's layout, an error in that layout bubbles to the parent's boundary, and global-error.tsx covers the root layout. Calling notFound() in a page renders the nearest not-found.tsx with a 404 status — I use that when a slug doesn't exist.

    Practise this question and get feedback

React interview questions

Rendering, reconciliation, hooks, state management and performance — from the questions every React interview asks to senior-level depth.

  1. 1.

    Explain the React rendering process. What happens when state changes?

    IntermediateTechnical

    What the interviewer is evaluating

    Whether you understand render vs commit, which underpins performance work.

    Key points a strong answer covers

    • Triggers. A render is triggered by a state update, a parent re-render or a context change.
    • Render phase. React calls your components to get new elements — this should be pure, with no side effects.
    • Reconciliation / diff. It compares the new tree with the previous one to work out what changed.
    • Commit phase. In the commit phase React applies the minimal DOM changes, then runs effects.
    • Batching. Multiple state updates in one event are batched into one render.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying a re-render always updates the DOM.
    • Putting side effects in the render body.

    Likely follow-up questions

    • Why must components be pure during render?
    • When do useLayoutEffect and useEffect run relative to paint?
    Example strong answer

    When state changes, React schedules a render of that component — and by default its children. In the render phase React calls the component functions to produce a new tree of elements; that work must be pure, because React may call it more than once or throw it away. It then reconciles: compares the new tree with the previous one to find what actually changed. In the commit phase it applies only those changes to the DOM, runs layout effects, lets the browser paint, and then runs useEffects. Updates inside one event are batched into a single render. So a re-render doesn't necessarily touch the DOM — it only does if the output differs.

    Practise this question and get feedback
  2. 2.

    How does React reconciliation work, and why do list keys matter?

    IntermediateTechnical

    What the interviewer is evaluating

    Understanding of the diffing heuristics and the bugs that bad keys cause.

    Key points a strong answer covers

    • Heuristic diff. React uses heuristics to diff in O(n) rather than a full tree comparison.
    • Type changes remount. If an element's type changes, React throws away that subtree and mounts a new one.
    • Keys identify items. Keys tell React which list item is which between renders.
    • Index key bugs. Index keys attach state to the wrong item when the list is reordered or items are inserted.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using Math.random() as a key.
    • Thinking keys are only about silencing the console warning.

    Likely follow-up questions

    • How can you use a key to reset a component's state on purpose?
    • What happens if two siblings share a key?
    Example strong answer

    Reconciliation is how React decides what changed between two renders. A full tree diff would be too slow, so React assumes two things: elements of a different type produce different trees — so if a <div> becomes a <section>, or one component becomes another, the old subtree is unmounted and a new one mounted — and keys identify children in a list. With stable keys from your data, React can match items even when they move, keeping their state and DOM. With index keys, inserting at the top shifts every key, so state like a text input's value ends up on the wrong row. You can also change a key deliberately to reset a component, like <Profile key={userId} />.

    Practise this question and get feedback
  3. 3.

    What is the difference between useMemo and useCallback? When are they worth using?

    IntermediateTechnical

    What the interviewer is evaluating

    Whether you optimise deliberately rather than by habit.

    Key points a strong answer covers

    • useMemo caches a value. useMemo caches the result of a calculation between renders.
    • useCallback caches a function. useCallback caches a function's identity — useCallback(fn, deps) is useMemo(() => fn, deps).
    • Dependencies. Both recompute only when their dependencies change.
    • When worth it. Worth it for expensive work, props to memoised children, or effect dependencies — measure first.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Wrapping everything in useMemo/useCallback “for performance”.
    • Thinking useMemo prevents a component from re-rendering.

    Likely follow-up questions

    • Why does useCallback do nothing if the child isn't wrapped in React.memo?
    • How does the React Compiler change this advice?
    Example strong answer

    useMemo caches a computed value; useCallback caches a function so its identity stays the same between renders — useCallback(fn, deps) is equivalent to useMemo(() => fn, deps). Both recompute only when a dependency changes. They're worth it in three cases: an expensive calculation like filtering thousands of rows, passing an object or callback to a child wrapped in React.memo so it can skip renders, and keeping a value stable when it's an effect dependency. Otherwise they add complexity for nothing — I measure with the Profiler first. With the React Compiler, much of this memoisation is automatic.

    Practise this question and get feedback
  4. 4.

    What are controlled and uncontrolled components?

    BeginnerTechnical

    What the interviewer is evaluating

    Form handling fundamentals.

    Key points a strong answer covers

    • Controlled = React state. A controlled input's value comes from React state and changes through onChange.
    • Uncontrolled = DOM keeps value. An uncontrolled input keeps its own value in the DOM; you read it with a ref or FormData.
    • Trade-offs. Controlled suits instant validation and formatting; uncontrolled is simpler and cheaper for big forms.
    • Libraries / file inputs. Libraries like React Hook Form are largely uncontrolled; file inputs are always uncontrolled.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Switching an input from uncontrolled to controlled (value undefined → string).
    • Not knowing file inputs can't be controlled.

    Likely follow-up questions

    • What causes the “changing an uncontrolled input to be controlled” warning?
    • How would you handle a 50-field form efficiently?
    Example strong answer

    A controlled input gets its value from React state and updates through onChange, so React is the single source of truth — ideal when you need instant validation, formatting like a phone mask, or to enable a button as the user types. An uncontrolled input keeps its own value in the DOM; you set a defaultValue and read it on submit with a ref or FormData. That's simpler and avoids a re-render per keystroke, which helps on big forms — React Hook Form is built on this. File inputs are always uncontrolled. A common bug is starting with value={undefined} and later passing a string, which flips an input from uncontrolled to controlled.

    Practise this question and get feedback
  5. 5.

    How does useEffect work, and what are the most common mistakes with it?

    IntermediateTechnical

    What the interviewer is evaluating

    Correct mental model of effects as synchronisation, not lifecycle methods.

    Key points a strong answer covers

    • Runs after commit. Effects run after React commits the render to the screen.
    • Dependencies. They re-run when dependencies change; missing deps cause stale values.
    • Cleanup. The returned cleanup runs before the next effect and on unmount.
    • Don't need an effect. Derived state and event-driven logic don't belong in effects; data fetching is better in a library or framework.
    • Strict mode double run. In development Strict Mode, effects mount, clean up and mount again to surface missing cleanup.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using an effect to copy props into state.
    • Fetching without cancelling, causing race conditions.

    Likely follow-up questions

    • Why does my effect run twice in development?
    • How do you avoid a race condition when fetching in an effect?
    Example strong answer

    useEffect synchronises a component with something outside React — a subscription, a timer, the document title. It runs after the render is committed, and again whenever a dependency changes; the function you return is the cleanup, which runs before the next run and on unmount. The common mistakes are missing dependencies, which give stale values; no cleanup, which leaks listeners; fetching without ignoring stale responses, which causes race conditions; and using effects for things that aren't effects — derived values should be calculated during render, and logic caused by a click belongs in the event handler. In development Strict Mode effects run, clean up and run again to expose missing cleanups.

    Practise this question and get feedback
  6. 6.

    How do you manage complex application state in React?

    AdvancedTechnical

    What the interviewer is evaluating

    Architecture judgement: choosing the simplest tool that fits.

    Key points a strong answer covers

    • Local first. Keep state as close as possible to where it's used; lift only when needed.
    • Server state is different. Remote data belongs in a cache library (TanStack Query, SWR) or the framework, not global state.
    • Context for low-frequency. Context suits rarely changing values; frequent updates re-render every consumer.
    • Global stores. For complex shared client state: useReducer, Zustand or Redux Toolkit.
    • URL state. Filters and selections often belong in the URL.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Putting everything, including API data, in one global store.
    • Using Context for fast-changing values like an input.

    Likely follow-up questions

    • What's the difference between client state and server state?
    • When would you pick Redux Toolkit over Zustand?
    Example strong answer

    I start by sorting state into kinds. Server state — data from APIs — goes in a caching layer such as TanStack Query or the framework's data loading, which handles loading, caching and refetching. URL state, like filters and the current tab, goes in search params so it's shareable. UI state stays local with useState, lifted only as far as needed, and useReducer when updates have complex rules. Context is for low-frequency values like the theme or current user, since every consumer re-renders on change. Only if there's genuinely complex shared client state — a multi-step editor, say — do I add a store like Zustand or Redux Toolkit.

    Practise this question and get feedback
  7. 7.

    How would you optimise a slow React application?

    AdvancedTechnical

    What the interviewer is evaluating

    A measured, methodical approach to performance.

    Key points a strong answer covers

    • Measure first. Profile with the React DevTools Profiler and Performance panel; check Core Web Vitals.
    • Reduce re-renders. Avoid unnecessary renders: colocate state, split context, memoise where measured.
    • Large lists. Virtualise long lists.
    • Bundle / loading. Code-split routes and heavy components; optimise images and bundle size.
    • Defer non-urgent work. useTransition / useDeferredValue keep typing responsive; move heavy work to a worker.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Jumping straight to memoising everything without profiling.
    • Ignoring network and bundle size and only looking at renders.

    Likely follow-up questions

    • What does the Profiler's flame graph tell you?
    • When would you use useDeferredValue?
    Example strong answer

    First I measure, because slow can mean many things. I check Core Web Vitals to see whether it's load time (LCP) or interaction (INP), then profile the slow interaction with the React DevTools Profiler and the browser's Performance panel. For load time: code-split routes and heavy widgets with lazy, trim the bundle, optimise images. For slow interactions: find components re-rendering unnecessarily — often state too high up or a context with a frequently changing value — and colocate state, split context, or memoise the expensive child. Long lists get virtualised. For heavy filtering while typing, useDeferredValue or useTransition keeps input responsive. Then I measure again to confirm the gain.

    Practise this question and get feedback
  8. 8.

    What are React Server Components, and how are they different from server-side rendering?

    AdvancedTechnical

    What the interviewer is evaluating

    Up-to-date knowledge of modern React architecture.

    Key points a strong answer covers

    • Render only on the server. Server Components run only on the server; their code never ships to the browser.
    • Zero client JS. They add no JavaScript to the bundle.
    • Direct data access. They can be async and read databases or secrets directly.
    • Client components for interactivity. Interactivity needs Client Components marked with 'use client'.
    • Not the same as SSR. SSR renders HTML for the first load then hydrates everything; RSC is about which components ever reach the client.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying RSC is just another name for SSR.
    • Passing functions or class instances as props from server to client.

    Likely follow-up questions

    • What can you pass as props from a Server Component to a Client Component?
    • Can a Client Component import a Server Component?
    Example strong answer

    Server Components are components that run only on the server — at build time or per request — and send their rendered result to the client, never their code. So they add no JavaScript to the bundle, can be async, and can read a database or use secrets directly. Anything interactive — state, effects, event handlers — goes in a Client Component marked 'use client', which you can render inside a Server Component, passing serialisable props. That's different from SSR: SSR renders all components to HTML for a fast first paint and then hydrates them all in the browser, so their code still ships. RSC changes which components ever reach the client. In practice you use both together.

    Practise this question and get feedback
  9. 9.

    When do you write a custom hook? Give an example.

    IntermediateTechnical

    What the interviewer is evaluating

    Code organisation and reuse of stateful logic.

    Key points a strong answer covers

    • Reuse stateful logic. Custom hooks extract and reuse stateful logic between components.
    • Naming / rules of hooks. They start with use and follow the rules of hooks.
    • Separate state per caller. Each component calling the hook gets its own state; hooks share logic, not state.
    • Example. e.g. useDebounce, useLocalStorage, useMediaQuery, useOnlineStatus.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Thinking two components using the same hook share state.
    • Wrapping trivial one-liners in hooks.

    Likely follow-up questions

    • How would you test a custom hook?
    • Why must hooks be called in the same order every render?
    Example strong answer

    I write a custom hook when two or more components need the same stateful logic, or when a component's logic is getting long and has a clear name. For example useDebouncedValue(value, delay) wraps a state and a timer effect, and useMediaQuery('(max-width: 640px)') subscribes to a media query and cleans up. A custom hook is just a function starting with use that calls other hooks, so it follows the rules of hooks — top level, same order every render. Importantly, it shares logic, not state: every component that calls it gets its own independent state. If I need shared state, that's context or a store.

    Practise this question and get feedback
  10. 10.

    What is React Context for, and what are its performance pitfalls?

    IntermediateTechnical

    What the interviewer is evaluating

    Knowing when Context is the right tool.

    Key points a strong answer covers

    • Avoid prop drilling. Context passes data through the tree without prop drilling.
    • Good uses. Theme, current user, locale, feature flags — values that change rarely.
    • Re-renders all consumers. When the value changes, every consumer re-renders.
    • Mitigations. Split contexts, memoise the value object, or use a store with selectors for fast-changing state.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Creating the value object inline so it changes every render.
    • Using one giant context for the whole app.

    Likely follow-up questions

    • Why should the provider's value be memoised?
    • How does a store with selectors avoid unnecessary renders?
    Example strong answer

    Context lets a value reach any depth of the tree without passing props through every level — good for the theme, the signed-in user, the locale or feature flags. The catch is that when the provider's value changes, every component that reads that context re-renders. So I keep fast-changing state out of it, split unrelated values into separate contexts, and memoise the value object — value={{ user, logout }} inline creates a new object each render and re-renders all consumers. For frequently updated shared state, a store like Zustand with selectors is better because components re-render only when the slice they select changes.

    Practise this question and get feedback
  11. 11.

    How do you handle errors in a React app?

    IntermediateTechnical

    What the interviewer is evaluating

    Resilience and user experience when things fail.

    Key points a strong answer covers

    • Error boundaries. Error boundaries catch render errors in their subtree and show a fallback UI.
    • What they don't catch. They don't catch errors in event handlers or async code — handle those with try/catch.
    • Placement. Place boundaries around routes and risky widgets, not just the root.
    • Reporting & recovery. Report errors to monitoring and offer a retry or reset.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Expecting an error boundary to catch a failed fetch in an event handler.
    • One boundary at the root that blanks the whole app.

    Likely follow-up questions

    • Why are error boundaries class components?
    • How would you reset an error boundary after the user retries?
    Example strong answer

    For rendering errors I use error boundaries: a component — still a class, or a library like react-error-boundary — that catches errors thrown while rendering its children and shows a fallback instead of a blank page. I place them around routes and risky widgets, so a broken chart doesn't take the whole dashboard down, and the fallback offers a retry that resets the boundary. They don't catch errors in event handlers, timers or promises, so those get try/catch and a visible error state. Every caught error is reported to monitoring like Sentry, with enough context to reproduce it.

    Practise this question and get feedback
  12. 12.

    What do Suspense and transitions (useTransition) do?

    AdvancedTechnical

    What the interviewer is evaluating

    Familiarity with concurrent React features.

    Key points a strong answer covers

    • Suspense shows a fallback. Suspense shows a fallback while children wait for code or data.
    • Works with lazy and data. It works with lazy() code splitting and Suspense-aware data sources, and enables streaming.
    • Transitions are non-urgent. startTransition marks an update as non-urgent so urgent input stays responsive.
    • Avoid jarring loaders. Transitions keep showing the old UI (with isPending) instead of a fallback flashing.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Thinking Suspense fetches data by itself.
    • Wrapping every update in a transition.

    Likely follow-up questions

    • How does useDeferredValue differ from useTransition?
    • How does Suspense enable streaming SSR?
    Example strong answer

    Suspense lets a component wait for something — code loaded with lazy(), or data from a Suspense-aware source like a framework loader or the use hook — and shows the nearest boundary's fallback meanwhile. Boundaries let you decide where loading states appear, and on the server they enable streaming HTML in chunks. Transitions are about priority: wrapping an update in startTransition marks it as non-urgent, so typing stays responsive while React prepares the new screen in the background, and an already-visible UI isn't replaced by a fallback — you get isPending to show a subtle indicator. A typical use is switching tabs or filtering a big list.

    Practise this question and get feedback
  13. 13.

    How do you test React components?

    IntermediateTechnical

    What the interviewer is evaluating

    Testing philosophy and practical tooling.

    Key points a strong answer covers

    • Test behaviour not implementation. Test what the user sees and does, not internal state.
    • Testing Library. React Testing Library queries by role and text.
    • User events / async. Simulate real interactions with user-event and await async UI.
    • Mock the network. Mock APIs at the network level (MSW) rather than mocking internals.
    • Test pyramid. Mostly integration-style component tests, plus a few end-to-end tests with Playwright.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Testing internal state or snapshot-testing everything.
    • Querying by class names or test ids when a role would do.

    Likely follow-up questions

    • Why prefer getByRole over getByTestId?
    • What would you cover with Playwright rather than unit tests?
    Example strong answer

    I test behaviour the way a user experiences it. With React Testing Library I render the component, find elements by role and accessible name — getByRole('button', { name: /save/i }) — interact with user-event, and assert on what appears. For async UI I use findBy queries. I mock the network with MSW instead of mocking hooks or modules, so components run their real code. I avoid testing internal state and large snapshots, which break on harmless refactors. Most coverage comes from these integration-style tests, with a handful of Playwright end-to-end tests for critical flows like sign-up and checkout.

    Practise this question and get feedback

Behavioural & HR questions you'll also get

These come up in almost every next.js developer interview. Story questions are best answered with STAR — Situation, Task, Action, Result.

  • Tell me about yourself.

    BeginnerHR

    What the interviewer is evaluating

    Whether you can give a concise, relevant pitch that frames your experience around this job.

    Key points a strong answer covers

    • Present. Start with your current role and what you do.
    • Relevant past. Pick the most relevant past experience.
    • Strength / achievement. Include one strength or achievement with evidence.
    • Why this role. Finish with why this role is the next step.

    Suggested answer structure

    1. Present — your current role in one or two sentences.
    2. Past — the experience most relevant to this job.
    3. Proof — one achievement or strength with evidence.
    4. Future — why this role is the logical next step.

    Common mistakes

    • Reciting your whole CV chronologically.
    • Personal life story unrelated to the job.
    • Going over two minutes.

    Likely follow-up questions

    • Why are you looking to leave your current role?
    • What would your manager say is your biggest strength?
    Example strong answer

    I'm a front-end developer with four years' experience, currently at a fintech start-up where I build the customer dashboard in React and TypeScript. Before that I spent two years at an agency building e-commerce sites, which taught me to work fast with lots of different clients. The thing I'm proudest of recently is leading our move to a shared component library, which cut the time to build new screens by about a third. I'm now looking for a role where I can work on a larger product with a strong design system, which is exactly what drew me to this position.

  • Why should we hire you?

    BeginnerHR

    What the interviewer is evaluating

    Whether you understand the role and can match your strengths to its needs with evidence.

    Key points a strong answer covers

    • Role's needs. Show you understand what the role needs.
    • Matching strengths. Match two or three strengths to those needs.
    • Evidence. Back each with evidence.
    • Enthusiasm. Close with genuine enthusiasm.

    Suggested answer structure

    1. Name the two or three things the role needs most.
    2. Match each with your experience and evidence.
    3. Add what makes you different.
    4. Finish with genuine interest.

    Common mistakes

    • Generic claims like 'I'm hardworking' with no evidence.
    • Comparing yourself to other candidates you don't know.

    Likely follow-up questions

    • What would you do in your first 90 days?
    • What's one area where you'd need support?
    Example strong answer

    From the job description and our conversation, you need someone who can take ownership of the customer onboarding process, work with sales and product, and improve the numbers. I've done exactly that for three years: at my current company I redesigned onboarding for new accounts and cut the time to first value from 14 days to 6. I'm comfortable working across teams — I run a weekly session with sales and product on customer feedback — and I'm very data-driven, so I'd measure everything from day one. I'm also genuinely excited about your product, because it solves a problem I've seen customers struggle with.

  • Tell me about a time you disagreed with a teammate. How did you handle it?

    BeginnerBehavioural

    What the interviewer is evaluating

    Handling conflict constructively and keeping relationships.

    Key points a strong answer covers

    • Listened to their view. Show you listened to understand their view.
    • Used facts / common goal. Bring it back to facts or a shared goal.
    • Resolution & relationship. Resolve it and keep the relationship.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Making the other person the villain.
    • A story where you were simply right and they gave in.

    Likely follow-up questions

    • What if you couldn't reach agreement?
    • Have you ever been wrong in a disagreement?
    Example strong answer (a fictional story — use your own)

    On a website rebuild, a senior designer wanted an animated, image-heavy homepage, and I was worried it would hurt mobile load times and SEO. As the developer responsible for performance, I needed us to agree before the sprint started. I asked her to walk me through what she was trying to achieve — she wanted the brand to feel premium. I built two quick prototypes, one with her full design and one with lighter animations, and we tested both on a mid-range phone together. Hers took nearly six seconds to load. We agreed on a version that kept the key animation but lazy-loaded the rest. The page launched loading in under two seconds, and she later asked me to review designs earlier. I learned that testing together beats debating.

  • Tell me about a mistake you made and what you learned.

    BeginnerBehavioural

    What the interviewer is evaluating

    Honesty, accountability and learning.

    Key points a strong answer covers

    • Real mistake owned. Own a real mistake.
    • Fixed it. Show how you fixed it and who you told.
    • Changed behaviour. Show what you changed afterwards.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Choosing a fake mistake like 'I work too hard'.
    • Blaming others.

    Likely follow-up questions

    • How did your manager react?
    • How do you know you haven't repeated it?
    Example strong answer (a fictional story — use your own)

    In my first year as a marketing coordinator, I sent a promotional email to our whole list with the wrong discount code — I'd tested the email but not clicked the code itself. Within an hour customers were complaining that it didn't work. I told my manager immediately, set the wrong code to apply the discount too, and sent a short correction email with an apology. We lost very little revenue, and some customers replied thanking us for the quick fix. Since then I use a pre-send checklist that includes testing every link and code as a customer would, and I asked for a second person to check any campaign to more than 10,000 people.

  • Describe a situation where you worked under pressure or to a tight deadline.

    BeginnerBehavioural

    What the interviewer is evaluating

    Prioritisation, composure and delivery.

    Key points a strong answer covers

    • The pressure. Make the pressure concrete.
    • Prioritised. Show how you prioritised.
    • Communicated. Show how you kept people informed.
    • Delivered. Show the outcome.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Glorifying working all night as the solution.
    • No mention of prioritising.

    Likely follow-up questions

    • What would you do if it was clear you couldn't make the deadline?
    • How do you stop pressure affecting quality?
    Example strong answer (a fictional story — use your own)

    Two days before a client presentation, our analyst fell ill and I had to finish the market research report she'd been leading. I listed everything left and asked the account director which sections the client cared about most — pricing and competitor comparison. I focused on those, reused verified data from our previous report, and moved the appendix to a follow-up email. I sent a short update each evening so nobody was surprised. We delivered the core report on time, the client approved the next phase, and the appendix followed two days later. I learned to ask early what matters most rather than trying to do everything equally well.

  • What would you do if you realised you were going to miss a deadline?

    BeginnerSituational

    What the interviewer is evaluating

    Transparency and problem solving.

    Key points a strong answer covers

    • Tell people early. Flag it as soon as you know.
    • Assess the gap. Work out how far off you are.
    • Options. Offer options: reduced scope, help, a new date.
    • Prevent repeats. Learn why it happened.

    Suggested answer structure

    1. Clarify the situation and what's at stake.
    2. Say what you'd do first, and why.
    3. Explain who you'd involve and how you'd communicate.
    4. Describe how you'd check the outcome and prevent a repeat.

    Common mistakes

    • Waiting until the deadline to say anything.
    • Promising you'll just work all night.

    Likely follow-up questions

    • What if your manager is unavailable?
    • Has this happened to you?
    Example strong answer

    I'd tell the person depending on it as soon as I realised, not at the deadline. Before that conversation I'd work out how far off I am and why, so I could offer options: delivering the most important part on time and the rest a few days later, getting help from a colleague, or agreeing a new date. Then I'd let them decide what works best for them, and keep them updated. Afterwards I'd look at why it slipped — usually underestimating something — so I plan better next time.

Ready to answer them out loud?

Run a timed next.js developer mock interview, type or speak your answers, and get a score breakdown with what to improve.

Interview questions for related roles