@folo/withcontext
micro HOC compose component accepts custom context values as props
Installation
npm install @folo/withcontext
Usage
import withcontext from "@folo/withcontext";
const ComponentWithContext = withcontext({
Component: MyComponent,
Consumer,
contextProps: ["prop1", "prop4"] // with no contextProps provided, it accepts all context props
});
You can compose all context props by not passing contextProps
const ComponentWithAllContextProps = withcontext({
Component: MyComponent,
Consumer
});
License
This project is licensed under the MIT License