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
91%
MIT

Dittofeed

Automation · Marketing

3,022

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
72
Repo Health
75
Technical
62
Dependency
Built with
TypeScript 91%
Updated 1 weeks ago
JavaScript
99%
AGPL 3.0

drawDB

Databases

40,114

Design database schemas visually in your browser and export executable SQL for any major database — no account required.

View details
78
Repo Health
70
Technical
73
Dependency
Built with
JavaScript 99%
Updated yesterday
Python
82%
GPL 3.0

ERPNext

ERP · Invoicing Finance

40,517

100% free, open-source ERP unifying accounting, manufacturing, inventory, CRM, HR, and POS in a single self-hostable platform.

View details
96
Repo Health
77
Technical
74
Dependency
Built with
Python 82%
JavaScript 13%
Updated today
TypeScript
53%
Apache 2.0

Flowsint

Automation · Developer Tools

9,911

A privacy-first, graph-based OSINT investigation platform with 30+ automated enrichers for mapping relationships between domains, IPs, people, and organizations.

View details
85
Repo Health
71
Technical
67
Dependency
Built with
TypeScript 53%
Python 45%
Updated 6 days ago
TypeScript
94%
AGPL 3.0

Laudspeaker

Automation · Marketing

2,629

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
45
Repo Health
66
Technical
62
Dependency
Built with
TypeScript 94%
Updated 3 months ago
Python
53%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,413

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
65
Dependency
Built with
Python 53%
TypeScript 45%
Updated today
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,091

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
51
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 4 months ago
TypeScript
89%
GPL 3.0

NoteGen

AI Assistants · Knowledge Management · Note Taking

12,914

Capture anything first, then let AI transform your scattered records into polished, structured Markdown notes with RAG-powered knowledge retrieval.

View details
87
Repo Health
74
Technical
67
Dependency
Built with
TypeScript 89%
Updated yesterday
TypeScript
95%
MIT

Open Lovable

AI Development

28,793

An open-source AI app builder that scrapes a live website and recreates it as a modern React app through chat — built by Firecrawl as a self-hostable example of the Lovable.dev workflow.

View details
50
Repo Health
66
Technical
69
Dependency
Built with
TypeScript 95%
Updated 2 weeks ago

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