Next.js Curriculum

Next.js Interview Questions for Freshers

The Next.js questions freshers are most often asked, with a short answer for each. Every question links to a full lesson with the traps interviewers look for and a step-by-step trace.

  1. 01 · Next.js Rendering Foundations · Easy

    Evolution of Web Rendering: CSR, SSR, SSG, and ISR

    CSR ships a minimal HTML shell and executes JavaScript in the browser. SSR renders full HTML dynamically on every request on the server.

    Full answer, traps and step-by-step trace
  2. 02 · Next.js Rendering Foundations · Medium

    Streaming SSR with React Suspense

    Streaming SSR uses HTTP chunked transfer encoding to send HTML to the browser incrementally.

    Full answer, traps and step-by-step trace
  3. 03 · Next.js Rendering Foundations · Medium

    Incremental Static Regeneration (ISR) Internals

    ISR enables static pages to update incrementally in the background without rebuilding the entire application. When a request arrives after the revalidation window, the edge CDN serves the stale cache immediately while triggering a background worker.

    Full answer, traps and step-by-step trace
  4. 04 · Next.js Rendering Foundations · Easy

    Understanding React Server Components (RSC) vs SSR

    SSR is a rendering technique that produces initial HTML strings from React components, but still ships their full JavaScript bundle to the browser for hydration.

    Full answer, traps and step-by-step trace
  5. 05 · Next.js Rendering Foundations · Medium

    Partial Prerendering (PPR) & Cache Components

    Partial Prerendering (PPR) combines static shell pre-rendering with dynamic streaming slots within a single HTTP response. At build time, Next.js generates static HTML for static segments and punches holes around dynamic Suspense boundaries.

    Full answer, traps and step-by-step trace
  6. 06 · App Router File Conventions · Easy

    The Route Hierarchy: Layouts, Templates, and Pages

    Layouts (layout.tsx) wrap page hierarchies, preserve client state across navigations, and do not re-render their DOM on route changes.

    Full answer, traps and step-by-step trace
  7. 07 · App Router File Conventions · Easy

    Route Groups and Multiple Root Layouts

    Route groups wrap folder names in parentheses, such as (marketing) and (dashboard), organizing files and layouts without affecting the public URL path.

    Full answer, traps and step-by-step trace
  8. 08 · App Router File Conventions · Easy

    Declarative Loading States with loading.tsx

    loading.tsx automatically wraps the sibling page.tsx and nested children inside an implicit React Suspense boundary.

    Full answer, traps and step-by-step trace
  9. 09 · App Router File Conventions · Medium

    Granular Error Handling with error.tsx and global-error.tsx

    error.tsx defines an isolated React Error Boundary around sibling page segments, allowing crashes to be caught without breaking the outer layout. It must be a Client Component and receives error and reset props.

    Full answer, traps and step-by-step trace
  10. 10 · App Router File Conventions · Medium

    Not-Found Handling: not-found.tsx and notFound()

    not-found.tsx renders a custom 404 UI for unmatched URLs or when programmatically triggered via notFound(). When invoked during server rendering, Next.js emits an HTTP 404 status code header to search engine crawlers.

    Full answer, traps and step-by-step trace
  11. 11 · Server Components & Boundaries · Easy

    The "use client" Boundary: What Crosses the Wire?

    The "use client" directive marks an entry point to the client bundle boundary, not code that executes exclusively in the browser. Client components still pre-render to HTML on the server during SSR.

    Full answer, traps and step-by-step trace
  12. 12 · Server Components & Boundaries · Medium

    Passing Server Components to Client Components as Children

    A Client Component cannot directly import a Server Component, but can accept it as a children or slot prop.

    Full answer, traps and step-by-step trace
  13. 13 · Server Components & Boundaries · Medium

    Third-Party Library Integration & Client Wrappers

    Many npm packages rely on React hooks (useState, useEffect) or browser globals without declaring "use client".

    Full answer, traps and step-by-step trace
  14. 14 · Server Components & Boundaries · Medium

    State Management & Context Architecture in RSC

    In an RSC-first architecture, server state is managed through the URL and Server Components, eliminating redundant global stores.

    Full answer, traps and step-by-step trace
  15. 15 · Data Fetching & Request Lifecycle · Easy

    Async Server Components & Direct Database Access

    Async React Server Components execute exclusively on the server, allowing developers to query databases (Prisma, Drizzle, pg) and backend services directly with async/await.

    Full answer, traps and step-by-step trace
  16. 16 · Data Fetching & Request Lifecycle · Medium

    Breaking Change: Async Request APIs in Next.js 15+

    In Next.js 15+, dynamic request data—specifically params, searchParams, cookies(), and headers()—is asynchronous and must be awaited.

    Full answer, traps and step-by-step trace
  17. 17 · Data Fetching & Request Lifecycle · Medium

    Request Waterfalls: Prevention with Promise.all and Suspense

    Request waterfalls occur when sequential async operations block subsequent requests unnecessarily.

    Full answer, traps and step-by-step trace
  18. 18 · Data Fetching & Request Lifecycle · Medium

    Static Param Pre-generation with generateStaticParams

    generateStaticParams replaces Pages Router’s getStaticPaths in the App Router. It runs at build time to define the list of route segment parameters that will be statically prerendered to HTML and RSC Flight files.

    Full answer, traps and step-by-step trace
  19. 19 · Data Fetching & Request Lifecycle · Medium

    Request Deduplication & React.cache Internals

    Request deduplication ensures that identical data requests within a single server render cycle execute only once. Native fetch() requests with identical URLs and options are deduplicated automatically by Next.js.

    Full answer, traps and step-by-step trace
  20. 20 · Next.js Caching Architecture · Medium

    Evolution of Caching: Next.js 14 Implicit vs Next.js 15+ Opt-In

    In Next.js 14, fetch requests and Route Handlers were cached aggressively by default (force-cache), leading to widespread developer confusion regarding stale dynamic data.

    Full answer, traps and step-by-step trace
  21. 21 · Next.js Caching Architecture · Medium

    On-Demand Revalidation: revalidateTag vs revalidatePath

    revalidateTag purges cache entries associated with a specific semantic cache key across the entire application, making it ideal for entity-based updates (e.g. updating a product).

    Full answer, traps and step-by-step trace
  22. 22 · Next.js Caching Architecture · Medium

    The Client-Side Router Cache & Stale Prefetch Pitfalls

    The client-side Router Cache stores rendered React Server Component Flight payloads in browser memory during a user session. When users navigate, Next.js serves pages instantly from this client cache.

    Full answer, traps and step-by-step trace
  23. 23 · Next.js Caching Architecture · Medium

    Dynamic Rendering vs Static Rendering Triggers

    In Next.js App Router, routes are statically prerendered by default unless they consume dynamic functions (cookies(), headers(), searchParams) or an uncached data source.

    Full answer, traps and step-by-step trace
  24. 24 · Server Actions & Form Mutations · Medium

    Server Actions Fundamentals & RPC Execution Model

    Server Actions are asynchronous server functions defined with the "use server" directive. They implement a type-safe Remote Procedure Call (RPC) protocol over HTTP POST requests.

    Full answer, traps and step-by-step trace
  25. 25 · Server Actions & Form Mutations · Medium

    Form Architecture: GET Navigation (next/form) vs POST (useActionState)

    In modern Next.js form architecture: use next/form for GET search and navigation forms to automatically update the URL query parameters with client-side soft navigation and prefetching.

    Full answer, traps and step-by-step trace
  26. 26 · Server Actions & Form Mutations · Medium

    Progressive Enhancement & JavaScript-Disabled Forms

    Progressive enhancement ensures that web applications remain fully functional even when client-side JavaScript is disabled, blocked by ad-blockers, or still downloading.

    Full answer, traps and step-by-step trace
  27. 27 · Server Actions & Form Mutations · Medium

    Server Action Closures, Revalidation, and Redirection

    Server Actions can close over server-side scope and receive bound parameters via Function.prototype.bind. After executing mutations, Server Actions orchestrate data updates through revalidatePath/revalidateTag and page navigation via redirect().

    Full answer, traps and step-by-step trace
  28. 28 · Security & Authentication Architecture · Medium

    Preventing Data Leaks with server-only & React Taint APIs

    Data leaks in React Server Components occur when sensitive server-side secrets or raw database records are accidentally imported by Client Components or passed across component boundaries.

    Full answer, traps and step-by-step trace
  29. 29 · Advanced Routing & Interception · Medium

    Parallel Routes: Dashboards and Conditional Slot Rendering

    Parallel Routes allow developers to render one or more independent page slots (@slot) simultaneously within the same parent layout.

    Full answer, traps and step-by-step trace
  30. 30 · Advanced Routing & Interception · Easy

    Dynamic Route Catch-Alls: [...slug] vs [[...slug]]

    Catch-all routes [...slug] match one or more subsequent path segments and supply them as a string array.

    Full answer, traps and step-by-step trace
  31. 31 · Asset Optimization & Performance · Medium

    Next.js Image Optimization (next/image) Internals

    The next/image component automatically optimizes images on-demand: converting formats to modern WebP/AVIF, resizing based on device viewport sizes, preventing Cumulative Layout Shift (CLS) via intrinsic aspect ratios, and deferring off-screen images using…

    Full answer, traps and step-by-step trace
  32. 32 · Asset Optimization & Performance · Medium

    Zero-CLS Font Optimization with next/font

    next/font automatically hosts Google Fonts and custom fonts locally at build time, eliminating external network requests to Google servers for GDPR compliance.

    Full answer, traps and step-by-step trace
  33. 33 · Asset Optimization & Performance · Medium

    Third-Party Script Optimization with next/script

    Third-party scripts (Google Tag Manager, analytics, chat widgets) are the #1 cause of degraded Total Blocking Time (TBT) and Interaction to Next Paint (INP).

    Full answer, traps and step-by-step trace
  34. 34 · Asset Optimization & Performance · Medium

    Code Splitting, Dynamic Imports & Package Optimization

    Next.js performs automatic route-based code splitting. To split heavy client components or libraries (like Monaco editor, Three.js, charting suites), developers use next/dynamic with React.lazy.

    Full answer, traps and step-by-step trace
  35. 35 · Dynamic Metadata & SEO · Medium

    Static vs Dynamic Metadata Generation

    Next.js provides two ways to define SEO tags: static metadata via the export const metadata object, and dynamic metadata via the generateMetadata async function.

    Full answer, traps and step-by-step trace
  36. 36 · Dynamic Metadata & SEO · Medium

    Dynamic OpenGraph Image Generation with @vercel/og

    Next.js supports programmatically generating social share images (og:image) using opengraph-image.tsx route conventions powered by @vercel/og and Satori.

    Full answer, traps and step-by-step trace
  37. 37 · Dynamic Metadata & SEO · Medium

    Dynamic XML Sitemaps and Robots Configuration

    Next.js provides special file-convention endpoints for search engine indexing: sitemap.ts generates standard XML sitemaps dynamically, while robots.ts generates robots.txt rules.

    Full answer, traps and step-by-step trace
  38. 38 · Dynamic Metadata & SEO · Medium

    Structured Data (JSON-LD) Implementation in Server Components

    Structured Data using schema.org vocabulary in JSON-LD format enables Google to understand page semantics and render rich search results (Rich Snippets, Star Ratings, FAQs, Product Badges).

    Full answer, traps and step-by-step trace
  39. 39 · Production Operations & DevOps · Medium

    Node.js Runtime vs Edge Runtime Tradeoffs

    Next.js supports two server runtimes: the full Node.js Runtime and the lightweight Edge Runtime (V8 isolates). The Node.js runtime supports the full Node API ecosystem, heavy npm libraries, and native database drivers, but has higher cold starts (~200ms).

    Full answer, traps and step-by-step trace
  40. 40 · Production Operations & DevOps · Medium

    Managing Environment Variables & Build-Time Inlining

    Next.js differentiates between private server-side environment variables and public client-side variables prefixed with NEXT_PUBLIC_.

    Full answer, traps and step-by-step trace
  41. 41 · Pages Router & Migration Strategy · Medium

    Pages Router Data Fetching: getServerSideProps vs getStaticProps

    In Pages Router, data fetching was defined per-page via exported functions: getServerSideProps executed on every request on the server (SSR), while getStaticProps executed at build time to produce static HTML/JSON (SSG), with optional revalidate for ISR.

    Full answer, traps and step-by-step trace
  42. 42 · Pages Router & Migration Strategy · Medium

    Custom _app.js and _document.js Lifecycle

    In Pages Router, _document.js rendered strictly on the server to customize the initial HTML shell (<html>, <head>, <body>), but could not contain client logic.

    Full answer, traps and step-by-step trace
  43. 43 · Pages Router & Migration Strategy · Medium

    Mapping Pages Router APIs to App Router Equivalents

    Migrating from Pages Router to App Router involves direct API mapping: getServerSideProps maps to async Server Components; getStaticProps maps to async fetch or "use cache"; getStaticPaths maps to generateStaticParams; next/head maps to generateMetadata; and…

    Full answer, traps and step-by-step trace
  44. 44 · Pages Router & Migration Strategy · Medium

    Migrating Navigation: next/router vs next/navigation

    In Pages Router, next/router provided a monolithic useRouter() hook returning pathname, query, asPath, and router events.

    Full answer, traps and step-by-step trace
  45. 45 · Enterprise Architecture & System Design · Medium

    Internationalization (i18n): App Router Routing

    Unlike Pages Router which featured built-in i18n configuration in next.config.js, App Router relies on subpath routing via dynamic route segments (app/[lang]/...) orchestrated by proxy.ts or middleware.ts.

    Full answer, traps and step-by-step trace
  46. 46 · Enterprise Architecture & System Design · Medium

    Monorepo Architecture with Turborepo & Shared Component Libraries

    Enterprise Next.js monorepos use Turborepo alongside npm/pnpm workspaces to manage multiple applications (web, mobile, admin, docs) and shared internal packages (ui, database, utils, tsconfig).

    Full answer, traps and step-by-step trace
  47. 47 · Debugging & Production Anti-Patterns · Medium

    Next.js Redirect Exception Suppression in try/catch Blocks

    In Next.js, redirect() and notFound() intentionally throw internal JavaScript exceptions (NEXT_REDIRECT and NEXT_NOT_FOUND) to interrupt control flow.

    Full answer, traps and step-by-step trace

Applying for the role too? Full stack developer resume examples