Next.jsEasy
What are the main features of Next.js?
Next.js bundles routing, server and client components, multiple rendering strategies, a caching model, server-side APIs and asset optimization into one framework, so a React app is production-ready without assembling those pieces yourself.
Routing and rendering
- App Router. File-system routing in
app/with nested layouts,loading.tsx,error.tsx, route groups, parallel and intercepting routes. - React Server Components. Server by default; add
"use client"only where you need state, effects or browser APIs. - Partial Prerendering. With Cache Components, every route gets a static shell served instantly, and dynamic parts stream in behind
<Suspense>. - Streaming of HTML and the RSC payload, so slow data never blocks the whole page.
Data and caching
"use cache"withcacheLifeandcacheTagfor explicit caching of functions and components.- On-demand revalidation with
revalidateTag,updateTagandrevalidatePath. - Server Functions (Server Actions) for mutations called directly from forms and buttons.
Backend
- Route Handlers (
route.ts) using the WebRequest/ResponseAPIs. - Proxy (
proxy.ts, formerly middleware) for redirects, rewrites and header logic before routing. after()to run work such as logging after the response is sent.
Optimization
next/imagefor responsive, lazy-loaded, modern-format images.next/fontto self-host fonts with zero layout shift.next/scriptfor third-party script loading strategies.- Metadata API for SEO, Open Graph images, sitemaps and robots files.
Tooling
Turbopack is the default bundler with a persistent disk cache, TypeScript is first-class, and the React Compiler is supported through reactCompiler: true. The dev server also exposes an MCP endpoint (/_next/mcp) so coding agents can read errors and routes.
Code example
tsx
1// One file per concern, all discovered by convention2// app/3// ├── layout.tsx shared shell (html/body)4// ├── page.tsx "/"5// ├── loading.tsx instant loading UI (Suspense)6// ├── error.tsx error boundary for this segment7// ├── blog/[slug]/page.tsx dynamic route "/blog/:slug"8// ├── api/health/route.ts Route Handler "GET /api/health"9// proxy.ts runs before matching requests1011// app/blog/[slug]/page.tsx12import { cacheLife, cacheTag } from "next/cache";1314async function getPost(slug: string) {15 "use cache";16 cacheLife("days");17 cacheTag(`post-${slug}`);18 const res = await fetch(`https://cms.example.com/posts/${slug}`);19 return res.json();20}2122export default async function Post({ params }: PageProps<"/blog/[slug]">) {23 const { slug } = await params;24 const post = await getPost(slug);25 return <article><h1>{post.title}</h1></article>;26}
Practice this question
Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the Next.js set.