react-selective-hydration

Hydrate prioritized React 18 UI early while streaming the rest via Suspense.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/Hallinna/interveiw-study-2026 --skill react-selective-hydration-hallinna
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-selective-hydration
Source: https://github.com/Hallinna/interveiw-study-2026/tree/main/.agents/skills/react-selective-hydration
Command: npx skills add https://github.com/Hallinna/interveiw-study-2026 --skill react-selective-hydration-hallinna

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Selective hydration solves the performance issue where React SSR pages stay non-interactive until all JavaScript for the entire component tree has loaded and hydration can begin.

Core Features & Use Cases

  • Stream HTML with React 18 SSR: Use renderToPipeableStream (Node) or renderToReadableStream (edge) to start sending markup as soon as parts of the UI are ready.
  • Hydrate prioritized UI early: Use hydrateRoot and Suspense boundaries so interactive components become usable without waiting for slower sections.
  • Avoid blocking hydration on slow work: Put heavy data-fetching components inside Suspense so they don’t delay sibling hydration.

Use case example: A streaming SSR page where comments require slower data fetching can render and hydrate other interactive widgets first, improving perceived responsiveness.

Quick Start

Use Suspense boundaries around slow, data-fetching components and stream the rest of the page using React 18’s renderToPipeableStream or renderToReadableStream, then hydrate with hydrateRoot.

Frequently Asked Questions about react-selective-hydration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent React SSR pages from staying non-interactive while streaming?

Selective hydration prevents React SSR pages from staying non-interactive by starting hydration for prioritized UI while streaming the rest of the page progressively. It uses hydrateRoot and Suspense boundaries so components become usable without waiting for slower sections.

What is the best way to hydrate interactive components before slow data fetching finishes in React 18?

The best way to hydrate components before slow data fetching finishes is wrapping heavy data-fetching components inside Suspense boundaries. This prevents them from delaying sibling hydration, allowing other interactive widgets to render and hydrate early using streaming SSR APIs.

Does selective hydration work with renderToPipeableStream and renderToReadableStream?

Yes, selective hydration works with renderToPipeableStream in Node and renderToReadableStream on the edge. These React 18 streaming SSR APIs start sending markup as soon as parts of the UI are ready, which then hydrate selectively using hydrateRoot.

How do I set up streaming SSR with Suspense boundaries for selective hydration?

To set up streaming SSR with selective hydration, wrap slow data-fetching components in Suspense boundaries and stream the rest of the page using renderToPipeableStream or renderToReadableStream. Then hydrate the application using hydrateRoot.

Do I need React 18 and hydrateRoot to use selective hydration for performance optimization?

Yes, you need React 18 and hydrateRoot to use selective hydration. It requires React 18+ apps, streaming SSR APIs, and Suspense boundaries to ensure interactive components become usable early without blocking hydration on slow data fetches.