npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rsc-xray/hydration

v0.8.0

Published

React hook for measuring client component hydration performance: track timing and costs per island

Downloads

45

Readme

npm Downloads

@rsc-xray/hydration

npm Downloads

Tiny helper library that records hydration timings for client components and exposes a hook that plugs into React.

What it solves

  • Marks hydration start/end for each island using the Performance API.
  • Provides a React hook (createHydrationHook) that instruments components with minimal boilerplate.
  • Returns aggregated timings so the analyzer and overlay can display hydration costs per route.

Installation

pnpm add @rsc-xray/hydration

Step-by-step usage

  1. Create the hook once

    import { createHydrationHook } from '@rsc-xray/hydration';
    import { useEffect, useRef } from 'react';
    
    export const useHydrationTimings = createHydrationHook({ useEffect, useRef });
  2. Instrument client components

    'use client';
    import { useHydrationTimings } from './hooks/useHydrationTimings';
    
    export function ProductGrid() {
      useHydrationTimings('product-grid');
      return <div>...</div>;
    }
  3. Read timings when needed

    import { getHydrationDurations } from '@rsc-xray/hydration';
    
    const durations = getHydrationDurations();
    console.log(durations['product-grid']);
  4. Reset between navigations/tests

    import { resetHydrationMetrics } from '@rsc-xray/hydration';
    resetHydrationMetrics();

Tests

  • packages/hydration/src/__tests__/hydration.test.tsx verifies the hook API and timing collection end-to-end, mirroring the steps above.

Run the suite with:

pnpm -F @rsc-xray/hydration test -- --run

RSC X‑Ray Pro

Paid plans available — unlock the full toolkit:

  • Overlay UI — live boundary tree, Suspense markers, bundle bytes, hydration timings
  • Flight tap & timeline — capture React Flight streaming; visualize chunk order, sizes, labels
  • Cache lens — inspect tags, revalidate policies, and route impact
  • Waterfall detector — find sequential awaits; guided fixes (preload/parallelize)
  • Codemods — use client, wrap with Suspense, add preload/hydration hook
  • VS Code extension — analyzer diagnostics + “Open in XRay” deep links
  • CI budgets & trends — PR comments, thresholds, and historical deltas

Learn more → https://rsc-xray.dev • Pricing → https://rsc-xray.dev/pricing