@figliolia/react-hooks
Version:
A small collection of simple React Hooks you're probably rewriting on a regular basis
16 lines (12 loc) • 351 B
text/typescript
import { useEffect } from "react";
import { AnimationFrame } from "Generics/AnimationFrame";
import { useController } from "./useController";
export const useAnimationFrame = () => {
const manager = useController(new AnimationFrame());
useEffect(() => {
return () => {
manager.abortAll();
};
}, [manager]);
return manager;
};