rooks
A massive, tree-shakeable collection of TypeScript-first React hooks
Repository Health
Technical Analysis
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
/experimentaland/temporalentry 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.
Used by 3 apps in this directory
Amplication
Developer Tools · AI Code Assistants · Automation
Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.
Nginx Proxy Manager
Developer Tools · Networking · Security
Manage Nginx reverse proxies and free Let's Encrypt SSL through a beautiful web interface — no Nginx expertise required.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.