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