Skip to content
Back to skills

React Progressive Hydration

ASecurity

> Delay hydration of below-fold or non-critical components to improve TTI

  • 20 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
developmenttypescriptreactnodeperformance

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add Intense-Visions/harness-engineering --skill react-progressive-hydration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Progressive Hydration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Progressive Hydration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/intense-visions-react-progressive-hydration/badge)](https://www.skillsdirectory.com/skills/intense-visions-react-progressive-hydration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# React Progressive Hydration

> Delay hydration of below-fold or non-critical components to improve TTI

## When to Use

- SSR pages where hydrating all components at once creates a long TTI
- Below-fold components that users will not interact with on page load
- Low-priority widgets (cookie banners, chat widgets, footer interactions)
- You need fast initial page interactivity without deferring all JS

## Instructions

1. Identify components that are not needed for initial interactivity.
2. Wrap them in a lazy-hydration wrapper that triggers hydration on:
   - **Viewport entry** (`IntersectionObserver`)
   - **User idle** (`requestIdleCallback`)
   - **First user interaction** (mousemove, touchstart)
3. Render the component's HTML from SSR immediately (for SEO and visual), but defer event handler attachment.
4. Use `React.lazy` + `Suspense` for code-splitting alongside hydration deferral.

```typescript
function LazyHydrate({ children }: { children: React.ReactNode }) {
  const [hydrated, setHydrated] = useState(false);
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const observer = new IntersectionObserver(([entry]) => {
      if (entry.isIntersecting) {
        setHydrated(true);
        observer.disconnect();
      }
    });
    if (ref.current) observer.observe(ref.current);
    return () => observer.disconnect();
  }, []);

  return (
    <div ref={ref}>
      {hydrated ? children : <div dangerouslySetInnerHTML={{ __html: '' }} />}
    </div>
  );
}
```

## Details

Progressive hydration is distinct from islands: islands prevent hydration entirely for static regions, while progressive hydration defers hydration of React components that will eventually be interactive.

**React 18 selective hydration:** `React.lazy` with Suspense boundaries already enables selective hydration in React 18 with `hydrateRoot`. React prioritizes hydrating components the user interacts with first.

**Libraries:** `react-lazy-hydration`, `react-intersection-observer` provide production-ready utilities for this pattern.

**Measurement:** Use Lighthouse TTI, Chrome DevTools Performance tab, and WebPageTest to verify improvements. Premature optimization without measurement is counterproductive.

## Source

https://patterns.dev/react/progressive-hydration

## Process

1. Read the instructions and examples in this document.
2. Apply the patterns to your implementation, adapting to your specific context.
3. Verify your implementation against the details and edge cases listed above.

## Harness Integration

- **Type:** knowledge — this skill is a reference document, not a procedural workflow.
- **No tools or state** — consumed as context by other skills and agents.

## Success Criteria

- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.

Files in this skill

  • SKILL.md2.8 KB
  • skill.yaml705 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.