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

13 lines
413 B
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import React from 'react';
import forwardRef from './forwardRef';
export default function transformContext(Context) {
return forwardRef(function (props) {
return React.createElement(Context.Consumer, null, function (context) {
return React.createElement(Context.Provider, {
value: props.mapToValue(context)
}, props.children);
});
}, {
displayName: 'ContextTransformer'
});
}