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 rooksimport { 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
| Entrypoint | Use it for | Stability and dependencies |
|---|---|---|
rooks | Stable hooks | Public stable surface; no Temporal polyfill. |
rooks/experimental | APIs still being refined | May change or be removed without the guarantees of the stable surface. |
rooks/temporal | Calendar and precise time hooks | Requires @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
- Get a working component in three steps.
- Browse all hooks by category, status, or entrypoint.
- Read the SSR and browser APIs guide before using DOM, permission, or device APIs.
- Read the experimental hooks guide before adopting an unstable API.
- Read the Temporal hooks guide for polyfill and time-zone setup.
For project work, see Contributing, Support, and Security.