UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

15 lines (14 loc) 473 B
/** * @name useAnimationFrame * @description - Hook that runs a callback function repeatedly using `requestAnimationFrame`. * It automatically stops the loop when the component unmounts. * * @param {() => void} callback The function to be called on each animation frame. * * @example * useAnimationFrame(() => { * // Update animation state here * console.log('Animating...'); * }); */ export declare const useAnimationFrame: (callback: () => void) => void;