JS Guide
HomeQuestionsSearchResources
Search

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeQuestionsnextjs

nextjs

Next.js app router, SSR, and full-stack patterns

Your Progress

0 of 5 completed

0%

5 Questions

senior Level
1
Explain the different rendering strategies in Next.js (SSR, SSG, ISR) and when to use each approach.
senior
rendering
Next.js offers multiple rendering strategies: Static Site Generation (SSG) for build-time rendering, Server-Side Rendering (SSR) for per-request rendering, Incremental Static Regeneration (ISR) for static pages with background revalidation, and hybrid approaches that mix strategies per route based on content requirements.
2
What are Server Actions in Next.js and how do they handle form submissions and mutations?
senior
server-actions
Server Actions are async functions that execute on the server, marked with 'use server'. They enable secure data mutations directly from components without creating API routes, support progressive enhancement (forms work without JavaScript), and integrate seamlessly with React's form handling and optimistic updates.
3
How does Middleware work in Next.js and what are common use cases?
senior
middleware
Next.js Middleware runs before a request is completed, executing at the Edge for low latency. It can rewrite URLs, redirect users, modify headers, and implement authentication checks. Defined in `middleware.ts` at the project root, it runs on every matched route and is ideal for cross-cutting concerns.
4
What performance optimization techniques does Next.js provide?
senior
performance
Next.js provides automatic optimizations including code splitting per route, image optimization via next/image, font optimization with next/font, script loading control with next/script, Server Components to reduce JavaScript bundles, Suspense for streaming, automatic prefetching of links, and edge deployment capabilities.
5
How does caching and revalidation work in Next.js?
senior
caching
Next.js has multiple cache layers: Request Memoization (dedupes fetch calls per render), Data Cache (persists fetch results across requests), Full Route Cache (caches rendered routes), and Router Cache (client-side cache). Revalidation can be time-based (revalidate option), on-demand (revalidatePath/revalidateTag), or opt-out entirely with cache: 'no-store'.