useTimeout ​
Hook that executes a callback function after a specified delay
typescript
import { useTimeout } from '@siberiacancode/reactuse';
Usage ​
typescript
const { clear, ready } = useTimeout(() => {}, 5000);
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
callback | () => void | - | The function to be executed after the timeout |
delay | number | - | The delay in milliseconds before the timeout executes the callback function |