Repository URL to install this package:
|
Version:
1.1.21 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _warn = _interopRequireDefault(require("./warn"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const isFn = prop => typeof prop === 'function';
/**
* renderProps
* is a render/children props interop.
* will pick up the prop that was used,
* or children if both are used
*/
const renderProps = ({
children,
render
}, ...props) => {
if (process.env.NODE_ENV !== 'production') {
(0, _warn.default)(isFn(children) && isFn(render), 'You are using the children and render props together.\n' + 'This is impossible, therefore, only the children will be used.');
}
const fn = isFn(children) ? children : render;
return fn ? fn(...props) : null;
};
var _default = renderProps;
exports.default = _default;