Course contentsShow
← Web Development
Lesson 1778 of 2,98233. Static Site Generation and JamstackFree lesson

Hybrid Approaches

Combining SSG with client-side data fetching: pre-rendering the shell and loading dynamic content in the browser.

Hybrid Approaches

You'll learn how to combine SSG's speed with dynamic data by pre-rendering static shells and hydrating them with fresh client-side content.

The Best of Both Worlds

Pure SSG gives you blazing-fast initial loads but struggles with frequently changing data. Rather than choosing between static and dynamic, hybrid approaches let you split your page into parts: pre-render the unchanging structure at build time, then fetch dynamic content in the browser after the page loads.

Think of it like a restaurant menu: the physical menu design (logo, layout, styling) is printed once and never changes. But today's specials? Those are written on a chalkboard that gets updated daily. You're combining permanent structure with fresh content.

How It Works

You generate a static HTML shell during build that includes:

  • Page layout and navigation
  • Styled components
  • Initial skeleton or loading states

When the page loads in the browser, JavaScript kicks in to:

  • Fetch current data from APIs
  • Populate dynamic sections
  • Update timestamps, user-specific content, or live data

This means users see meaningful content instantly (the shell) while personalized or time-sensitive data loads moments later. Your first paint is fast because it's static, but the final experience is dynamic.

Common Patterns

  • User dashboards: Static layout, dynamic user data
  • Product listings: Pre-rendered grid, client-side inventory/pricing updates
  • News sites: Static article structure, dynamic comment counts
  • E-commerce: Static product pages, dynamic cart and availability

The key is identifying which parts of your page change frequently (fetch dynamically) versus which remain constant (pre-render statically).

Key Takeaway: Hybrid approaches combine SSG's performance with CSR's flexibility by pre-rendering static shells and fetching dynamic data client-side, giving you fast initial loads and fresh content.