useDebounceCallback ​
Hook that creates a debounced callback
utilities
test coverage
Last changed: 20 hours ago
Installation ​
Library
CLI
Manual
typescript
import { useDebounceCallback } from '@siberiacancode/reactuse';
Usage ​
typescript
const debouncedCallback = useDebounceCallback(() => console.log('callback'), 500);
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
callback | (...args: Params) => Return | - | The callback function |
delay | number | - | The delay in milliseconds |
Returns
(...args: Params) => Return
Type declaration ​
typescript
export type DebouncedCallback<Params extends unknown[]> = ((...args: Params) => void) & {
cancel: () => void;
};
Source ​
Source • DemoContributors ​
D
H