Usedebounce

useDebounce

The useDebounce hook is a utility that helps debounce a value, allowing you to delay the execution of a function until after a specified amount of time has elapsed since the last time the debounced function was invoked.

Installation

  npx hooks-boost install

Usage

import { useDebounce } from 'hooks-boost';
 
const [val,setVal] = useState("")
const debouncedValue = useDebounce(val, 300);

Parameters

  • value (any): The value you want to debounce.
  • delay (number): The time in milliseconds to wait before updating the debounced value.

Returns

PropertyTypeDescription
debouncedvalueanyThe Value that will update after debounced time