UNPKG

@figliolia/react-hooks

Version:

A small collection of simple React Hooks you're probably rewriting on a regular basis

13 lines (12 loc) 379 B
import { useEffect } from "react"; import { AnimationFrame } from "../Generics/AnimationFrame.js"; import { useController } from "./useController.js"; export const useAnimationFrame = () => { const manager = useController(new AnimationFrame()); useEffect(() => { return () => { manager.abortAll(); }; }, [manager]); return manager; };