// packages/compose/src/hooks/use-throttle/index.js
import { useMemoOne } from "use-memo-one";
import { useEffect } from "@wordpress/element";
import { throttle } from "../../utils/throttle/index.mjs";
function useThrottle(fn, wait, options) {
  const throttled = useMemoOne(
    () => throttle(fn, wait ?? 0, options),
    [fn, wait, options]
  );
  useEffect(() => () => throttled.cancel(), [throttled]);
  return throttled;
}
export {
  useThrottle as default
};
//# sourceMappingURL=index.mjs.map
