Package Exports
- @restart/context
- @restart/context/forwardRef
- @restart/context/mapContextToProps
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@restart/context) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@restart/context 
React context helpers.
Install
npm install @restart/context
Usage
import React from 'react';
import mapContextToProps from '@restart/context/mapContextToProps';
const MyValueContext = React.createContext(null);
function MyComponent(props) {
/* ... */
}
const MyComponentWithMyValue = mapContextToProps(
MyValueContext,
myValue => ({ myValue }),
MyComponent,
);
const withMyValue = Component =>
mapContextToProps(
{
consumers: MyValueContext,
mapToProps: myValue => ({ myValue }),
displayName: `withMyValue(${Component.displayName || Component.name})`,
},
Component,
);