Progressive Hydration: Hydrating on Interaction
What you'll learn: How to defer hydrating components until users actually interact with them, dramatically reducing initial JavaScript execution.
The Core Idea
By default, React hydrates your entire component tree immediately after the server HTML loads. But what if a component isn't interactive yet? You're paying the CPU cost for nothing. Progressive hydration on interaction means delaying hydration until the user actually tries to interact with that component—clicking a button, hovering, focusing an input, etc.
Think of it like a restaurant that doesn't turn on the kitchen until customers arrive. Why heat the ovens if no one's ordered?
How It Works
You wrap components in Suspense boundaries and use techniques to defer their hydration:
<Suspense fallback={<StaticVersion />}>
<InteractiveCarousel />
</Suspense>
When combined with lazy loading and visibility detection, React can:
- Render the server HTML immediately
- Show a lightweight static version or placeholder
- Only load and hydrate the JavaScript when the user scrolls near it or clicks on it
The Interaction Trigger
The pattern typically involves event delegation: attach a lightweight listener at a higher level that detects user interaction, then triggers hydration of the specific component. The first click might feel slightly delayed, but you've saved seconds of JavaScript parsing on page load.
Why This Matters
For components "below the fold" or rarely used (like a comments section or advanced filters), you avoid the cost until it's needed. Time to Interactive drops dramatically because you're not executing code for features users might never touch.
Key Takeaway: Progressive hydration on interaction defers JavaScript execution until users actually need interactivity, optimizing for the critical first moments of page load.