UNPKG

965 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var React = require('react');
6
7function _extends() {
8 _extends = Object.assign || function (target) {
9 for (var i = 1; i < arguments.length; i++) {
10 var source = arguments[i];
11
12 for (var key in source) {
13 if (Object.prototype.hasOwnProperty.call(source, key)) {
14 target[key] = source[key];
15 }
16 }
17 }
18
19 return target;
20 };
21
22 return _extends.apply(this, arguments);
23}
24
25function useFC(render) {
26 var renderRef = React.useRef();
27 renderRef.current = render;
28 return React.useRef(function RenderFunctionWrapper(restProps) {
29 return renderRef.current(restProps);
30 }).current;
31}
32function useWith(Wrapped, props) {
33 return useFC(function (restProps) {
34 return /*#__PURE__*/React.createElement(Wrapped, _extends({}, props, restProps));
35 });
36}
37
38exports.default = useWith;
39exports.useFC = useFC;
40//# sourceMappingURL=use-with.cjs.js.map