text: import { useEffect, useRef } from 'react';
  
  function useInterval(callback, delay, reset) {
    const savedCallback = useRef();
  
    useEffect(() => {
      savedCallback.current = callback;
    });
  
    useEffect(() => {
      function tick() {
        savedCallback.current();
      }
      if (delay !== null) {
        let id = setInterval(tick, delay);
        return () => clearInterval(id);
      }
    }, [delay, reset]);
  }
  
  export default useInterval;
  