Connect React Context to your component easily and with type safety
- You dont want your Component to know about React.Context
- You want to unit test your component without providing a context
npm i react-connect-ctx
import { connectContext } from 'react-connect-ctx';
export default connectContext(APP_CONTEXT)(
PersonComponent,
(context: AppContext): Partial<ComponentAProps> => {
return {
api: context.api
}
});