import { useRef, useEffect } from 'react';
export function useHandlers(props, factories) {
  var propsRef = useRef(props);
  var handlersRef = useRef(function () {
    var names = Object.keys(factories);
    return names.reduce(function (handlers, name) {
      handlers[name] = function () {
        var handler = factories[name](propsRef.current);
        return handler.apply(void 0, arguments);
      };

      return handlers;
    }, {});
  }());
  useEffect(function () {
    propsRef.current = props;
  });
  return handlersRef.current;
}
//# sourceMappingURL=useHandlers.js.map