useRaf ​
Hook that defines the logic for raf callback
typescript
import { useRaf } from '@siberiacancode/reactuse';
Usage ​
typescript
useRaf(() => console.log('callback'));
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
callback | UseRafCallback | - | The callback to execute |
options.delay? | number | - | The delay between each frame in milliseconds |
options.enabled? | boolean | true | Whether the callback should be enabled |