Next.js โšก Recently updatedUpdated on Jun 30, 2026 โ€” this content may still be evolving.

Next.js: Revision Sheet

Rendering (MEMORIZE)

PatternWhenApp Router
SSGStatic, build timefetch default cache
SSRPer request, freshcache: 'no-store'
ISRStatic + regennext: { revalidate: N }
CSRClient fetch'use client' + useEffect

Decision Quick Pick

  • Blog/docs โ†’ SSG
  • Product catalog โ†’ ISR
  • User dashboard โ†’ CSR/SSR + auth
  • Personalized feed โ†’ SSR
  • Landing page โ†’ SSG

App Router Structure

app/
  layout.tsx      # wraps all pages
  page.tsx        # route UI
  loading.tsx     # Suspense fallback
  error.tsx       # error boundary
  [id]/page.tsx   # dynamic route
  api/.../route.ts

Server vs Client

  • Server (default): async fetch, no hooks, smaller bundle
  • Client: 'use client', useState, onClick

Key APIs

import Link from 'next/link';
import Image from 'next/image';
import { useRouter, useParams, useSearchParams } from 'next/navigation';

Pages Router (legacy)

  • getStaticProps โ†’ SSG
  • getServerSideProps โ†’ SSR
  • getStaticPaths โ†’ dynamic SSG paths

Hydration

Server HTML + client JS attach. Mismatch if server โ‰  client render.

Middleware

middleware.ts โ€” auth redirects, headers, geo routing.

Metadata

export const metadata = { title: '...', description: '...' };

Image

next/image โ€” optimized, lazy, requires width/height or fill.

Env Vars

  • NEXT_PUBLIC_* โ†’ browser
  • Others โ†’ server only

Quick Answers

QuestionAnswer
App vs Pages Router?App = RSC, layouts; new projects use App
Why ISR?CDN speed + periodic updates without full rebuild
Link vs a?Link client-side navigation, prefetch
Route groups?(folder) organizes, not in URL
Server Actions?Run server code from forms โ€” mutations

Red Flags

  • SSR everything (expensive)
  • SSG for personalized pages (wrong data)
  • 'use client' on entire app (defeats RSC)
  • useEffect fetch what Server Component could do