react-selective-hydration

Enable selective hydration for SSR React apps using Suspense and hydrateRoot.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/PMKhai/claude-config --skill react-selective-hydration-pmkhai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-selective-hydration
Source: https://github.com/PMKhai/claude-config/tree/main/skills/react-selective-hydration
Command: npx skills add https://github.com/PMKhai/claude-config --skill react-selective-hydration-pmkhai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The technique enables React SSR to hydrate interactive components before the entire page is loaded, improving time-to-interactivity on streaming pages.

Core Features & Use Cases

  • Selective hydration with Suspense to render interactive components early while streaming the rest
  • Streaming server-side rendering using renderToPipeableStream (Node) or renderToReadableStream (Edge) to improve TTI
  • Use hydrateRoot to hydrate interactive components promptly as streams arrive

Quick Start

Invoke selective hydration by wrapping interactive UI in Suspense boundaries and rendering with renderToPipeableStream or renderToReadableStream.

Frequently Asked Questions about react-selective-hydration

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

FAQPage Schema
How does React selective hydration improve time-to-interactivity with streaming SSR?

React selective hydration improves time-to-interactivity by hydrating interactive components before the entire streaming page loads. It uses Suspense boundaries to prioritize interactive UI, allowing users to engage with components as streams arrive rather than waiting for full page load.

How do I implement selective hydration using hydrateRoot and Suspense in React 18?

To implement selective hydration, wrap interactive UI components in Suspense boundaries and render them using renderToPipeableStream or renderToReadableStream. Then use hydrateRoot on the client to hydrate interactive components promptly as the streams arrive.

Does React selective hydration work in both Node and Edge environments?

Yes, selective hydration works in both Node and Edge environments. It applies to streaming SSR workflows using renderToPipeableStream for Node or renderToReadableStream for Edge, requiring React 18+, Suspense boundaries, and hydrateRoot for implementation.

What is the best way to hydrate interactive components early while streaming the rest of the page?

The best way to hydrate interactive components early is using selective hydration with Suspense. This technique renders interactive parts immediately while streaming the remaining page content, leveraging renderToPipeableStream or renderToReadableStream for efficient delivery.

Why do I need Suspense boundaries for streaming server-side rendering in React?

You need Suspense boundaries for streaming server-side rendering because they enable selective hydration. By wrapping interactive UI in Suspense, React can hydrate those components early as streams arrive, preventing the entire page from blocking on slow-loading content.