Next.js · module 13 of 16

Caching, Revalidation & Performance

Choose static, dynamic, cached, and revalidated behavior intentionally while measuring real page performance.

Course map
visitorcacheanswers immediatelydatabaserefreshed in the backgroundThe visitor never waits on the database. The cost is that what they saw may be a few seconds old —which is fine for an article and wrong for a bank balance.The question is never "should I cache?" but "how stale is acceptable here?"Answer that per route and the revalidation time stops being a number you guess at.
Caching, Revalidation & Performance — the idea in one picture

What this module covers

5 steps · Next.js

  1. Step 1. Lesson: Caching, Revalidation & Performance

    Choose static, dynamic, cached, and revalidated behavior intentionally while measuring real page performance. Learning objectives - Recognize when caching, revalidation & performance is the right tool. - Explain the role of cache, revalidate, Suspense. - Build a small working example before combining it with a larger interface. - Identify one accessibility, maintainability, or error-handling improvement. Read the example, predict what it will do, then complete the small change described in the check question.

    Choose static, dynamic, cached, and revalidated behavior intentionally while measuring real page performance. In Next.js, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Next.js] Use the example to demonstrate caching, revalidation & performance.

  2. Step 2. Quiz: Caching, Revalidation & Performance

    Check your understanding of Caching, Revalidation & Performance.

    Product data, sessions, and static content have different correctness and freshness requirements. In Next.js, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Next.js] Complete the knowledge check.

  3. Step 3. Exercise: Caching, Revalidation & Performance

    Classify page data by freshness needs and apply suitable cache, revalidation, and streaming behavior.

    This exercise turns the Caching, Revalidation & Performance lesson into a working code change. In Next.js, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Next.js] Does the solution use cache and revalidate and Suspense?

  4. Step 4. Review lab: Explain & improve Caching, Revalidation & Performance

    Rebuild the exercise without copying the solution. Then improve it in two ways: make the code easier to understand and add one useful edge case, responsive behavior, accessibility improvement, or error state. Finally, write a short explanation of how cache, revalidate, Suspense work together.

    Rebuilding from memory and improving an edge case turns recognition into durable skill. In Next.js, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Next.js] Does the improved version still use cache, revalidate, Suspense clearly?

  5. Step 5. Mini project: Caching, Revalidation & Performance

    Optimize a content storefront with tagged revalidation, streaming boundaries, responsive images, bundle analysis, and measured Core Web Vitals.

    The mini project combines the module lesson, quiz, and exercise into one portfolio-ready result. In Next.js, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Next.js] Does the project apply the module's caching, revalidation & performance skills?

Loading code lab...