GoScrobble/web/node_modules/@restart/context/transformContext.js

22 lines
664 B
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
exports.__esModule = true;
exports.default = transformContext;
var _react = _interopRequireDefault(require("react"));
var _forwardRef = _interopRequireDefault(require("./forwardRef"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function transformContext(Context) {
return (0, _forwardRef.default)(function (props) {
return _react.default.createElement(Context.Consumer, null, function (context) {
return _react.default.createElement(Context.Provider, {
value: props.mapToValue(context)
}, props.children);
});
}, {
displayName: 'ContextTransformer'
});
}