import * as React from "react";
import useEnhancedEffect from "../useEnhancedEffect/useEnhancedEffect.js";
function useEventCallback(fn) {
  const ref = React.useRef(fn);
  useEnhancedEffect(() => {
    ref.current = fn;
  });
  return React.useRef((...args) => (
    // @ts-expect-error hide `this`
    (0, ref.current)(...args)
  )).current;
}
export {
  useEventCallback as default
};
