Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 06 / Topic 6 of 6

Confirming exactly how much client JavaScript this mini-build added

Part 5 section 6 diffed a page's chunk list against a known pure-server baseline (/store/about) to prove a page added zero extra chunks. The same technique run the other way around measures this part's mini-build precisely: /store/quick-add/p1 has two Client Components (AddToCartCounter, ExpandablePanel), so it should add exactly one extra chunk beyond the shared baseline (components bundled together commonly land in the same chunk):

$ npm run build
$ diff <(grep -o 'chunks/[A-Za-z0-9_.-]*\.js' .next/server/app/store/quick-add/p1.html | sort -u) \
       <(grep -o 'chunks/[A-Za-z0-9_.-]*\.js' .next/server/app/store/about.html | sort -u)
2d1
< chunks/0ms5w_5g_mbkv.js

One extra chunk, confirmed to actually contain both components' own code and nothing from the Server Component they wrap:

$ grep -c "Add to cart" .next/static/chunks/0ms5w_5g_mbkv.js
1
$ grep -c '"Hide"' .next/static/chunks/0ms5w_5g_mbkv.js
1

(The exact chunk hash is a build artifact and varies between builds — rerun the diff on your own build rather than trusting this filename.) This is the practical meaning of "push "use client" down to the leaves": the amount of JavaScript a page ships is countable, and it tracks exactly the number and size of the Client Components actually used, not the page's overall complexity.

A closely related fact this part leans on but doesn't yet explain: the installed package's own docs describe hydration as the step where "React uses [its] instructions to attach event listeners to the DOM and bring the application to life" — which is why the server-rendered HTML above already shows real <button> elements with the right text and aria-expanded attributes before any JavaScript has run; only the onClick wiring itself waits for hydration. Watching that handoff happen in a real browser (as opposed to reading the HTML it produces) needs browser automation this harness doesn't have — the same limitation Part 3 named for template.tsx's remount and useRouter().push.

Done here? The practice set for Part 6 — including the solutions — is on the part page.

Search the guide