Stage 3
Stage 3: Data, Caching and Mutations
Content wave complete. Parts 9–12 are written, built, and verified against this harness — see each part's own README for real, captured output.
Goal: Fetch, cache, revalidate, and mutate data the Next.js way, using the Cache Components model that ships by default in the Next.js version this course is pinned to (see
TOOLING.md). Time: ~26 h of lessons at 1–1.5 hours a day · Level: solid on Stage 2's Server/Client boundary — caching decisions don't make sense without it
Parts in this stage
| Part | Topic | Learning outcomes | Time |
|---|---|---|---|
| 9 | Data fetching in Server Components | Fetch data directly in an async Server Component; fetch two sources in parallel instead of accidentally creating a request waterfall; understand request memoization within a single render |
~6 h |
| 10 | Caching with Cache Components | Apply the use cache directive at the data level and the UI level; set a cache lifetime with cacheLife; tag a cache entry with cacheTag; explain the cacheComponents config flag and why new apps ship with it on by default |
~7 h |
| 11 | Revalidation | Invalidate a cached entry on demand with revalidatePath and revalidateTag; distinguish on-demand from time-based revalidation; relate this to the older ISR (Incremental Static Regeneration) mental model for reading pre-Cache-Components code |
~6 h |
| 12 | Server Actions and forms | Write a 'use server' function and call it directly from a <form action={...}>; manage pending/error state with useActionState and useFormStatus; return validation errors to the form without a client-side fetch call; apply an optimistic update |
~7 h |
Prerequisites for this stage
- Stage 2 (Server Components, Client Components, Suspense/streaming, the rendering-philosophy preview)
- No capstone is attached to this stage directly — Parts 9–12 feed straight into Stage 4's capstone, QuickCart
A note on caching before this stage is written
Next.js's data-caching story has changed in each major version (route-segment config flags → the fetch cache option → experimental dynamicIO/useCache → the default Cache Components model). This stage must be written and verified against whichever Next.js major version is current when the content wave starts, even if that differs from the version pinned in TOOLING.md today. Do not port a caching snippet from memory or from an older tutorial without re-verifying it against a running next build.