@ant-design/pro-utils
Version:
20 lines (19 loc) • 889 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useRefFunction = void 0;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _react = require("react");
var useRefFunction = exports.useRefFunction = function useRefFunction(reFunction) {
var ref = (0, _react.useRef)(null);
ref.current = reFunction;
return (0, _react.useCallback)(function () {
var _ref$current;
for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
rest[_key] = arguments[_key];
}
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call.apply(_ref$current, [ref].concat((0, _toConsumableArray2.default)(rest)));
}, []);
};