mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
13 lines
413 B
JavaScript
13 lines
413 B
JavaScript
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'
|
|
});
|
|
} |