Skip to content
TrademarkTrademark
Docs
Hooks

useDebounce

Updated: February 22, 2026
View on GitHub

The useDebounce hook delays updating a value until after a specified delay period has passed without changes. This is useful for optimizing performance in scenarios like search inputs, API calls, or expensive computations.

Used in components: Input, Textarea (for character count updates), EmojiPicker (for search filtering)

Most of the time you don't need to use this hook directly. The Input and Textarea components already use it internally when `maxLength` is set. Use this hook when you need custom debouncing logic in your own components.

Features

  • Delays value updates until user stops typing
  • Prevents excessive API calls or computations
  • Simple and lightweight implementation
  • Works with any value type

Basic usage

Debounce a search input to avoid excessive API calls:

With API calls

Optimize API requests by debouncing user input:

With expensive computations

Debounce expensive calculations:

API Reference

Type
Default
value
any—
delay
number—

Return value

Returns the debounced value that updates only after the specified delay period has passed without changes.

Common use cases

Search inputs

Form validation

Window resize handling

Performance tips

  • Choose appropriate delay: 300-500ms for search, 100-200ms for UI feedback
  • Combine with useMemo: Debounce input, then memoize expensive computations
  • Cancel pending requests: Clean up API calls when component unmounts
Edit this page on GitHub