react-selective-hydration

Enable selective hydration with streaming SSR in React 18.

1|Updated Jul 12, 2025
One-click install
npx skills add https://github.com/ubay1/next15-starter --skill react-selective-hydration-ubay1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-selective-hydration
Source: https://github.com/ubay1/next15-starter/tree/main/.agents/skills/react-selective-hydration
Command: npx skills add https://github.com/ubay1/next15-starter --skill react-selective-hydration-ubay1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the slow “whole-page hydration” problem where users must wait for large bundles and slow components to finish loading before the UI becomes interactive.

Core Features & Use Cases

  • Selective hydration with React 18: Enables interactive parts of the page to hydrate as soon as they arrive, rather than waiting for the entire app bundle.
  • Streaming SSR using React 18 APIs: Uses renderToPipeableStream (Node) or renderToReadableStream (edge) to start sending HTML earlier.
  • Suspense-based isolating of slow components: Wraps heavy data-fetching sections in Suspense so sibling UI can stream and hydrate independently.

Example use case: A dashboard page where “Comments” requires slow data fetching—hydrate the rest of the page immediately, then stream and hydrate the Comments area later.

Quick Start

Wrap the slow, data-fetching component inside a Suspense boundary and switch your SSR rendering to renderToPipeableStream or renderToReadableStream so the page can stream and hydrate interactively via 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 hydrate React components selectively with streaming SSR?

Selective hydration with streaming SSR uses React 18's Suspense boundaries and hydrateRoot to hydrate fast UI chunks independently. This allows interactive parts of the page to hydrate as soon as they arrive, without waiting for the entire app bundle or slow components to finish loading.

What is the best way to isolate slow data-fetching components during React SSR?

The best way to isolate slow data-fetching components during React SSR is wrapping them in Suspense boundaries. This allows sibling UI to stream and hydrate independently via renderToPipeableStream or renderToReadableStream, preventing slow components from blocking the rest of the page.

Does selective hydration work with renderToPipeableStream in Node?

Yes, selective hydration works with renderToPipeableStream in Node and renderToReadableStream on the edge. Both React 18 streaming APIs enable sending HTML earlier and hydrating streamed interactive chunks independently via hydrateRoot without waiting for the full tree.

Why does whole-page hydration block user interaction in React?

Whole-page hydration blocks user interaction because users must wait for large bundles and slow components to finish loading before the UI becomes interactive. Selective hydration solves this by enabling interactive parts of the page to hydrate as soon as they arrive from the streaming SSR response.

How do I set up React 18 streaming SSR for a dashboard with mixed fast and slow components?

To set up React 18 streaming SSR for a dashboard, switch your SSR rendering to renderToPipeableStream or renderToReadableStream. Wrap slow, data-fetching sections like Comments in Suspense boundaries so the rest of the page hydrates immediately via hydrateRoot.

When do I need Suspense boundaries for selective hydration?

You need Suspense boundaries for selective hydration when your SSR page contains mixed fast and slow components relying on Suspense-compatible data fetching. This isolates heavy data-fetching sections so sibling UI can stream and hydrate independently without waiting for all JavaScript to load.