Rooks

Rooks documentation

Focused, typed React hooks for state, browser APIs, events, timing, and more.

Rooks is a collection of focused React hooks for React 18 and 19. Import stable hooks from the main package, opt into experimental hooks deliberately, and keep Temporal's optional dependency isolated behind its own entrypoint.

Install

pnpm add rooks
import { useCounter } from "rooks";

export default function Counter() {
  const { value, increment, decrement, reset } = useCounter(0);

  return (
    <section aria-labelledby="counter-title">
      <h2 id="counter-title">Count: {value}</h2>
      <button type="button" onClick={decrement}>
        Decrease
      </button>
      <button type="button" onClick={increment}>
        Increase
      </button>
      <button type="button" onClick={reset}>
        Reset
      </button>
    </section>
  );
}

Choose an entrypoint

EntrypointUse it forStability and dependencies
rooksStable hooksPublic stable surface; no Temporal polyfill.
rooks/experimentalAPIs still being refinedMay change or be removed without the guarantees of the stable surface.
rooks/temporalCalendar and precise time hooksRequires @js-temporal/polyfill in environments without native Temporal and a runtime with BigInt.

Rooks is published as ESM. See Entrypoints and compatibility for package and runtime details.

Where to go next

For project work, see Contributing, Support, and Security.

On this page