import { Tick } from "../utils/tick" ; import { useEffect , useRef } from "react" ; param frame param interval export function useTick ( frame ) { const framer = useRef ( frame ) ; framer . current = frame ; useEffect ( ( ) => { const tick = new Tick ( ( ) => framer . current ( ) ) ; tick . start ( ) ; return ( ) => tick . destroy ( ) ; } , [ ] ) ; }