Skip to main content
Version: Next (Unreleased)

useDebounce

Returns a debounced copy of a value — the copy only updates after the specified delay has elapsed since the last change.

Signature​

function useDebounce<T>(value: T, delay?: number): T

Parameters​

ParameterTypeDefaultDescription
valueT—The value to debounce
delaynumber500Milliseconds to wait after the last change

Return value​

The debounced value of type T. It will always equal the initial value on the first render. A delay of 0 defers the update to the next tick.

useDebounce vs useDeferredValue

React's useDeferredValue defers re-rendering expensive UI without a fixed delay. Use useDebounce when you need a time-based delay, for example to avoid firing a request on every keystroke.

Live example​

Loading playground...