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