Stop Rebuilding UI

Shadcn.io is not affiliated with official shadcn/ui

React useDebounceCallback Hook

React useDebounceCallback hook with cancel, flush, and isPending controls. Lodash debounce under the hood. TypeScript ready.

Debounce any callback in React without stale closure issues. useDebounceCallback wraps your function with lodash debounce and returns cancel, flush, and isPending controls. Configurable delay (default 500ms), leading/trailing edge, and maxWait options. Auto-cancels on unmount to prevent memory leaks. Perfect for search inputs, autocomplete, form validation, or any rapid-fire event handler. Works with Next.js App Router and SSR. Use useDebounceValue if you need debounced state instead of a debounced function.

React useDebounceCallback Hook preview

Scroll to load preview

Installation

FAQ

Was this page helpful?

Sign in to leave feedback.