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

@waitkit/react

v0.4.1

Published

React provider and hooks for Waitkit controllers.

Readme

@waitkit/react

React provider and hooks for using a Waitkit controller in development UI.

@waitkit/react does not call setupWaitKit for you. Create the controller with @waitkit/core, then pass it to WaitKitProvider.

Installation

npm install @waitkit/core @waitkit/react
# or
pnpm add @waitkit/core @waitkit/react
# or
yarn add @waitkit/core @waitkit/react
# or
bun add @waitkit/core @waitkit/react

Provider

import { setupWaitKit } from '@waitkit/core';
import { WaitKitProvider } from '@waitkit/react';

const scenarios = {
  'slow-network': [{ url: '/api/users', delay: 1000 }],
  'server-error': [{ url: '/api/users', errorRate: 1 }],
};

const scenarioNames = Object.keys(scenarios);

const waitkit = setupWaitKit({
  enabled: import.meta.env.DEV,
  activeScenario: 'slow-network',
  scenarios,
});

root.render(
  <WaitKitProvider controller={waitkit} scenarioNames={scenarioNames}>
    <App />
  </WaitKitProvider>,
);

Pass a stable scenarioNames array. Avoid creating it inline during render, because changing the array reference recreates the React store.

useWaitKit

import { useWaitKit } from '@waitkit/react';

function WaitKitToggle() {
  const waitkit = useWaitKit();

  return (
    <button onClick={waitkit.enabled ? waitkit.disable : waitkit.enable}>
      {waitkit.enabled ? 'Disable Waitkit' : 'Enable Waitkit'}
    </button>
  );
}

useWaitKit returns:

  • enabled: whether rule matching is enabled.
  • scenario: active scenario name.
  • scenarioNames: scenario names passed to WaitKitProvider.
  • controller: original core controller.
  • enable(), disable(), restore(): controller methods that also update React subscribers.

useWaitKitScenario

import { useWaitKitScenario } from '@waitkit/react';

function ScenarioSelect() {
  const { scenario, scenarioNames, setScenario, resetScenario } = useWaitKitScenario();

  return (
    <select
      value={scenario ?? ''}
      onChange={(event) => {
        const value = event.currentTarget.value;
        value === '' ? resetScenario() : setScenario(value);
      }}
    >
      <option value="">Default rules</option>
      {scenarioNames.map((name) => (
        <option key={name} value={name}>
          {name}
        </option>
      ))}
    </select>
  );
}

WaitKitDevTools

WaitKitDevTools renders a fixed floating panel for development. It shows the current enabled/disabled status, a scenario switcher, and a live log of recent matched and error requests.

import { WaitKitDevTools } from '@waitkit/react';

root.render(
  <WaitKitProvider controller={waitkit} scenarioNames={scenarioNames}>
    <App />
    <WaitKitDevTools />
  </WaitKitProvider>,
);

Props:

  • maxLogEntries (optional, default 20): Maximum number of log entries to keep.

WaitKitDevTools must be rendered inside WaitKitProvider. It reads state from context and calls controller methods directly — no additional setup needed.

Controller Updates

Use the methods returned by useWaitKit and useWaitKitScenario from React UI. If you call the original controller directly outside React, React subscribers will not be notified automatically.