Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const createContext = value => {
- const context = reactCreateContext(value);
- export const withContext = Component => {
- const C = props => (
- <context.Consumer>
- {context => <Component {...context} {...props} />}
- </context.Consumer>
- );
- C.displayName = `withContext(${Component.displayName || Component.name})`;
- return C;
- };
- return {
- Provider: context.Provider,
- Consumer: context.Consumer,
- withContext,
- };
- };
Add Comment
Please, Sign In to add comment