import { useRef as o, useEffect as e } from "react";
function i(r, t) {
  const n = o(() => {
  });
  e(() => {
    n.current = r;
  }, [r]), e(() => {
    function u() {
      n.current();
    }
    if (t != null) {
      const c = setInterval(u, t);
      return () => clearInterval(c);
    }
    return () => {
    };
  }, [t]);
}
export {
  i as useInterval
};
