0

Why Next.js (library vs framework)

Foundationsused in ~100% of apps

Before you write a line of Next.js, you need to answer the question every interviewer opens with: why not just use React? If you can't name what a framework gives you that a library doesn't, every later decision — routing, server rendering, caching — looks like arbitrary magic instead of a deliberate tradeoff.

Core idea. React is a UI library: it renders components and manages state, and that's the whole job. Next.js is a framework built on top of React that supplies the parts a real app needs but React deliberately leaves out — routing, server rendering, a bundler, and a data/caching layer. A library is a tool you call; a framework is a structure that calls you.
Playground, this isn't a screenshot
component tree server client
<LikeButton />Server Component
Build error: useState / onClick are not allowed in a Server Component. Add "use client" to fix it.
Render HTML / read props
await data directly (db, fetch)
useState / useEffectclient only
onClick & event handlersclient only
window / localStorageclient only
JS shipped to browser0 KB
JavaScript shipped to the browser0 KB / 71 KB if all client

2 interactive component(s) are still Server Components— they would crash the build because Server Components can't use state or event handlers. Select one and add "use client".

↑ play a little first, then dig in