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
| Parameter | Type | Default | Description |
|---|---|---|---|
value | T | — | The value to debounce |
delay | number | 500 | Milliseconds 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.
Live example
Loading playground...