use-debounce

Tiny, tree-shakeable React hooks for debouncing and throttling values and callbacks.

Library
npm
v10.1.1
3,384 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
57 /100 Fair
Development Activity 40
Maintenance 32
Community 56
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 86
Code Quality 88
Innovation 90
Learning Curve 85

use-debounce is a sub-kilobyte collection of React hooks that bring debouncing and throttling to values and callbacks without ceremony. Its API is intentionally modeled on the lodash/underscore debounce and throttle functions, so the mental model transfers directly, while adapting cleanly to React’s render and effect lifecycle.

The library exposes three hooks — useDebounce for values, useDebouncedCallback for functions, and useThrottledCallback for rate-limiting — each returning control helpers such as cancel, flush, and isPending. It is fully typed, server-rendering friendly, and ships with support for maxWait, leading, and trailing edge behavior.

What You Get

  • Three focused hooks: useDebounce (values), useDebouncedCallback (functions), and useThrottledCallback (rate limiting).
  • Control helpers on every debounced function — cancel, flush, and isPending — to manage in-flight invocations.
  • Configurable timing via maxWait, leading, and trailing options, matching the lodash debounce semantics developers already know.
  • First-class TypeScript types and a tree-shakeable, sub-1 KB bundle that is safe for server-side rendering.

Common Use Cases

  • Debouncing a search input so a network request only fires after the user stops typing.
  • Throttling scroll or resize handlers to avoid excessive re-renders and layout work.
  • Flushing a pending debounced save on component unmount so unsaved changes are persisted.

Under The Hood

Architecture — The library is layered around a single core hook. useDebouncedCallback.ts holds all timing logic (timers, maxWait accounting, leading/trailing edges, and the cancel/flush/isPending control functions), memoized with useMemo and kept current across renders via refs. useDebounce.ts builds on it by storing the latest value in a ref and forcing a re-render when the debounced setter fires, while useThrottledCallback.ts is a thin wrapper that simply calls useDebouncedCallback with maxWait equal to the wait interval. index.ts re-exports the three hooks plus their shared TypeScript types, so all public surface derives from one well-tested engine.

Tech Stack — Written entirely in TypeScript targeting React (declared only as a peer dependency, react: '*', with zero runtime dependencies of its own). It builds with microbundle into CommonJS, ESM, and UMD outputs, is tested with Jest and Testing Library under a jsdom environment, and enforces a strict sub-1 KB budget per entry point using size-limit. Linting is handled by ESLint with the standard config and Prettier.

Code Quality — Quality is high for a micro-library. Three substantial test files (useDebounce.test.tsx, useDebouncedCallback.test.tsx, useThrottledCallback.test.tsx, together over 40 KB) cover timing edges, cancellation, flushing, pending state, and server rendering. The public interfaces are fully typed and documented with JSDoc, naming mirrors the familiar lodash vocabulary, and the ref-based implementation carefully avoids stale closures across renders.

API Design — Developer experience is a core strength. Adopting lodash’s debounce/throttle naming and options (maxWait, leading, trailing) means the API is instantly familiar, and returning [value, controls] or a callable augmented with cancel/flush/isPending keeps usage terse. Getting started requires a single import and one hook call, and the README is dense with runnable CodeSandbox examples for each scenario.

Used by 39 apps in this directory

TypeScript
100%
Other

Activepieces

AI Assistants · Automation · Mcp

24,756

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 100%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
TypeScript
96%
Other

Amplication

AI Code Assistants · Automation · Developer Tools

16,015

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
58
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 96%
Updated 3 months ago
Java
72%
Other

ByteChef

AI Agents · Automation

1,003

Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.

View details
85
Repo Health
82
Technical
67
Dependency
Built with
Java 72%
TypeScript 28%
Updated 5 days ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,650

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
67
Repo Health
76
Technical
62
Dependency
Built with
JavaScript 90%
Updated 3 weeks ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

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

View details
54
Repo Health
75
Technical
62
Dependency
Built with
TypeScript 92%
Updated 6 months ago
Python
47%
MIT

Docs

CMS · File Storage

16,868

Open-source collaborative knowledge platform with real-time editing, AI writing tools, and full self-hosting control — built by the French and German governments.

View details
88
Repo Health
81
Technical
68
Dependency
Built with
Python 47%
TypeScript 45%
Updated 4 days ago
TypeScript
100%
Other

Dub

Analytics · Marketing

24,835

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
62
Dependency
Built with
TypeScript 100%
Updated 4 days ago
TypeScript
99%
AGPL 3.0

fountain-ink

Blogging

64

A self-hostable, decentralized blogging platform built on Lens Protocol — own your content, audience, and distribution forever.

View details
26
Repo Health
66
Technical
63
Dependency
Built with
TypeScript 99%
Updated 7 months 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