1 import React from 'react';
3 const UserContext = React.createContext(null);
5 export const withUser = (WrappedComponent, as) => function WithUserContext(props) {
6 return <UserContext.Consumer>
7 {user => <WrappedComponent {...{[as || 'user']: user, ...props}} />}
8 </UserContext.Consumer>;
11 export default UserContext;