UNPKG

@figliolia/react-hooks

Version:

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

17 lines (16 loc) 582 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useAnimationFrame = void 0; const react_1 = require("react"); const AnimationFrame_1 = require("../Generics/AnimationFrame"); const useController_1 = require("./useController"); const useAnimationFrame = () => { const manager = (0, useController_1.useController)(new AnimationFrame_1.AnimationFrame()); (0, react_1.useEffect)(() => { return () => { manager.abortAll(); }; }, [manager]); return manager; }; exports.useAnimationFrame = useAnimationFrame;