rooks

A massive, tree-shakeable collection of TypeScript-first React hooks

Library
npm
v9.9.0
3,447stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
91/100Excellent
Development Activity100
Maintenance100
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture80
Code Quality82
Innovation72
Learning Curve78

Rooks bundles over 150 focused React hooks covering application state, browser APIs, DOM events, timing, and common UI behaviors into a single, tree-shakeable, TypeScript-first package. Instead of hand-rolling useLocalStorage, useDebounce, useOnClickOutside, or useGeolocation for every project, teams install one dependency and import only the hooks they use, keeping bundle size proportional to actual usage.

The library is ESM-only and targets React 18 and 19, with an /experimental and /temporal entry point for hooks built on newer or less-stable APIs (such as the Temporal proposal) kept separate from the stable core. A managed monorepo (Turborepo + pnpm workspaces), changesets-based releases, size-limit budget checks, and Vitest coverage back a very actively maintained project with frequent releases.

What You Get

  • 150+ individually documented hooks spanning state, browser/DOM APIs, events, timing, forms, and UI behavior
  • Tree-shakeable ESM build so unused hooks are stripped from production bundles
  • Full TypeScript typings generated alongside the build for every hook
  • Separate /experimental and /temporal entry points for newer or less-stable hooks
  • A documented, versioned changelog driven by Changesets with frequent, predictable releases

Common Use Cases

  • Replacing ad-hoc internal hook utilities (debounce, throttle, click-outside, local storage sync) with a single well-tested dependency
  • Adding browser API access (geolocation, clipboard, intersection observer, media queries) without writing the boilerplate wrapper hooks
  • Managing component-level state patterns (counters, toggles, previous-value tracking, undo/redo) consistently across a codebase
  • Prototyping quickly by reaching for a ready-made hook instead of writing and testing a new one for common UI interactions

Under The Hood

Architecture - Rooks lives in a Turborepo/pnpm-workspace monorepo (packages/rooks, plus internal eslint-config/typescript-config packages and a docs apps/website); the published package’s src/hooks/ directory holds ~150 self-contained hook modules, each exported individually and re-exported from index.ts (stable), experimental.ts, and temporal.ts entry points, keeping unstable or Temporal-API-dependent hooks isolated from the main import path.

Tech Stack - The library is authored in TypeScript, built to ESM-only output via a custom build.js (esbuild-based) with tsc-generated declaration files, and depends on a handful of small runtime helpers (fast-deep-equal, lodash.debounce, raf, use-sync-external-store) plus an optional @js-temporal/polyfill for the temporal entry point; React 18/19 are peer dependencies only.

Code Quality - Each hook has a matching test file under src/__tests__/ (155 test files for ~150 hooks), run via Vitest with coverage tracking through Codecov; CI also runs sanity-check scripts that verify types, imports, and lint rules across every hook, and a size-limit budget check gates bundle-size regressions on every PR.

API Design - Every hook follows React’s native hook-naming and calling conventions (useX(...) returning a value, tuple, or object), so adoption requires no new mental model beyond standard hooks; per-hook documentation on the dedicated docs site (with live examples) plus consistent TypeScript signatures keep the API surface predictable across the full catalog, though the sheer hook count (150+) means discoverability relies heavily on searching docs rather than IDE autocomplete alone.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search