Next.js
React, but it handles the boring 80%.
▶ the lesson · narrated sketch video · tap for sound
the intro
Next.js is a framework on top of React that adds routing, server rendering, data fetching, and deployment conventions. Components render on the server by default, pages are folders, and APIs live next to your pages. It removes most of the setup work a real React app needs.
the sample
a page is just a folder
app/
page.tsx → /
about/page.tsx → /about
users/[id]/
page.tsx → /users/:idfun fact ✦
Next.js popularized “file-based routing” — your folder tree literally becomes your sitemap.
the docs
the deep dive
the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid
React answers one question: how do I render this UI? A real app asks five more — routing, data fetching, server rendering, SEO tags, deployments. Next.js answers those with conventions instead of config: the file system is the router, components render on the server by default, and the boring 80 percent is already done.
conventions instead of config
key terms
server component
Renders on the server and ships zero JavaScript for it. The default in the app router.
async function Page()"use client"
A marker that flips a file back to browser-land: state, effects, and event handlers live there.
"use client" at the topfile router
Folders inside app become URLs. No route config file, no imports to register.
app/about/page.tsxISR
Incremental static regeneration: a static page that quietly rebuilds every N seconds.
revalidate: 60how it works
- 1Create the folder
app/about/page.tsx is now the /about route, server-rendered by default. That is the whole tutorial.
- 2Fetch during render
Components can be async: await your data right in the component body. No useEffect, no loading-spinner choreography.
- 3Mark the interactive bits
Buttons with onClick need "use client". Everything else stays on the server and ships no JS.
- 4Add the polish
export const metadata for titles and social cards; a loading.tsx file becomes an instant skeleton.
the code, explained
a dynamic route, data included
side by side
server comp
- renders once on the server
- ships zero JS for itself
- can read databases directly
- no state, no handlers
client comp
- interactive: state and events
- code ships to the browser
- hooks and effects allowed
- opt in with "use client"
Props crossing into a "use client" component must be serializable: numbers, strings, plain objects. A function or a class instance passed from a server component will throw at runtime. Pass data and ids down; pass behavior up via server actions.
quick answers
Is Next.js free?
The framework is MIT-licensed and self-hosts anywhere. Vercel, which makes it, sells hosting — but hosting is optional, not required.
Do I still write React normally?
Components and hooks are unchanged. The new rules: server by default, "use client" where interactive, folders as routes.
When should I not use it?
A single static page, or an app entirely behind a login with no SEO needs. Plain React with Vite is lighter for those.
quick hits about Next.js
short answers · interviews, tips, trivia & hidden gems