Skip to content

useRaf ​

Category
Utilities

Hook that defines the logic for raf callback

typescript
import { useRaf } from '@siberiacancode/reactuse';

Usage ​

typescript
useRaf(() => console.log('callback'));

Demo ​

Api ​

Parameters

NameTypeDefaultNote
callbackUseRafCallback-The callback to execute
options.delay?number-The delay between each frame in milliseconds
options.enabled?booleantrueWhether the callback should be enabled

Contributors ​

Source • Demo