usehooks-ts

A tree-shakable collection of 30+ ready-to-use React hooks, written in TypeScript.

Library
npm
v3.1.1
7,862 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
61 /100 Good
Development Activity 48
Maintenance 32
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
87 /100 Excellent
Architecture 85
Code Quality 88
Innovation 84
Learning Curve 90

usehooks-ts is a React hooks library written entirely in TypeScript that packages the most common client-side patterns into a single, dependency-light import. It ships more than thirty focused hooks covering boolean and counter state, localStorage and sessionStorage persistence, media queries, event listeners, intersection and resize observers, debouncing, dark mode, and more.

The library is designed to be minimal and fully tree-shakable through its ESM build, so you only pay for the hooks you actually import. Each hook is strongly typed, documented with JSDoc, and covered by tests, making it a low-risk way to avoid re-writing the same boilerplate across React projects.

What You Get

  • 30+ typed React hooks importable individually from a single package
  • Full TypeScript type inference on every hook’s arguments and return values
  • SSR-friendly hooks with options like initializeWithValue for safe hydration
  • A tree-shakable ESM build so only the hooks you import are bundled
  • Extensive JSDoc documentation and a companion docs site with live examples

Common Use Cases

  • Persisting UI state across reloads with useLocalStorage or useSessionStorage
  • Building responsive layouts and theming with useMediaQuery and useDarkMode
  • Wiring up DOM interactions via useEventListener, useHover, and useOnClickOutside
  • Throttling expensive updates with useDebounceValue or useDebounceCallback
  • Tracking element visibility and size with useIntersectionObserver and useResizeObserver

Under The Hood

Architecture — The library is a pnpm + Turborepo monorepo whose publishable surface is the packages/usehooks-ts package. Its src/index.ts is a flat barrel that re-exports one directory per hook (useBoolean, useLocalStorage, useMediaQuery, and 30+ more), so each hook is an isolated module with its own implementation and colocated *.test.ts file. Hooks compose internally rather than duplicating logic — for example useLocalStorage builds on useEventCallback and useEventListener, and dispatches a custom local-storage window event to keep every consumer of a key in sync across components and tabs.

Tech Stack — Written in TypeScript (~90% of the codebase) targeting React 16.8+ through 19 via a broad peerDependencies range. The only runtime dependency is lodash.debounce. It is bundled with tsup (esbuild) into dual ESM/CJS outputs with generated .d.ts types and sideEffects: false for tree-shaking. Tests run on Vitest against a jsdom environment with Testing Library, and the repo uses Turborepo, changesets for releases, TypeDoc for docs generation, and ESLint including a tree-shaking lint plugin.

Code Quality — Quality is high: nearly every hook ships a dedicated Vitest suite (29 test files across 33 hooks), and each public hook carries thorough JSDoc with parameter docs, @example blocks, and links to the docs site. SSR safety is handled explicitly through an IS_SERVER guard and opt-in initializeWithValue options rather than left to the caller. Naming is consistent and idiomatic, and generics preserve full type inference on return tuples.

API Design — The developer experience is a core strength. Every hook is imported by name from the package root, follows React’s own tuple/return conventions, and requires almost no boilerplate to adopt (const [value, setValue] = useLocalStorage('key', 0)). Options objects are optional with sensible defaults, the public API is uniform across the whole set, and each hook maps to a documented page with live examples, giving a very shallow learning curve for React developers.

Used by 28 apps in this directory

TypeScript
96%

Open Scouts

AI Agents · Automation

1,370

Create automated AI scouts that continuously search the web and send email alerts when they find what you're looking for.

View details
33
Repo Health
65
Technical
69
Dependency
Built with
TypeScript 96%
Updated 5 months ago
TypeScript
99%
Other

openclaude

AI Agents · AI Code Assistants

34,123

Run Claude Code workflows against any LLM — OpenAI, Gemini, Ollama, and 200+ backends — from a single terminal-first CLI.

View details
87
Repo Health
78
Technical
71
Dependency
Built with
TypeScript 99%
Updated today
TypeScript
91%
AGPL 3.0

OpenPanel

Analytics

7,187

Open-source Mixpanel alternative with session replay, MCP integration, and privacy-first product analytics you fully control.

View details
83
Repo Health
74
Technical
64
Dependency
Built with
TypeScript 91%
Updated yesterday
TypeScript
96%
Apache 2.0

Pezzo

AI Development · Monitoring

3,278

Open-source LLMOps platform for prompt management, AI observability, intelligent caching, and real-time cost tracking across LLM providers.

View details
59
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 96%
Updated 2 months ago
Go
68%
MIT

Probo

Automation · Security

1,476

Open-source GRC platform for engineering and security teams.

View details
87
Repo Health
90
Technical
69
Dependency
Built with
Go 68%
TypeScript 30%
Updated yesterday
Rust
72%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,326

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
87
Repo Health
81
Technical
64
Dependency
Built with
Rust 72%
TypeScript 25%
Updated today
Python
100%
Other

Sourcebot

AI Code Assistants · Developer Tools · Search

4,005

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
86
Repo Health
83
Technical
61
Dependency
Built with
Python 100%
Updated 2 days ago
Go
75%
AGPL 3.0

Teleport

Authentication · Security

21,016

Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.

View details
94
Repo Health
81
Technical
68
Dependency
Built with
Go 75%
TypeScript 16%
Updated 4 days ago
TypeScript
55%
Other

Tolgee

Developer Tools

4,139

In-context localization platform that lets developers and translators edit app strings directly in the running application, with AI-powered machine translation and framework SDKs for React, Angular, Vue, and Svelte.

View details
91
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 55%
Kotlin 44%
Updated yesterday

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