Skip to content

useDebounce ​

A hook that deal with the debounced value.

Code demonstration ​

API ​

typescript
const debouncedValue = useDebounce(
  value: any,
  options?: Options
);

Params ​

PropertyDescriptionTypeDefault
valueThe value to debounce.Ref<any>-
optionsConfig for the debounce behaviors.Options-

Options ​

PropertyDescriptionTypeDefault
waitThe number of milliseconds to delay.number1000
leadingSpecify invoking on the leading edge of the timeout.booleanfalse
trailingSpecify invoking on the trailing edge of the timeout.booleantrue
maxWaitThe maximum time func is allowed to be delayed before it’s invoked.number-

Source ​

Source · Document · Demo

Released under the MIT License.