@folo/withcontext

0.1.5 • Public • Published

@folo/withcontext

micro HOC compose component accepts custom context values as props


NPM Version NPM Download npm bundle size (minified) npm bundle size (gzip) MIT License CircleCI Codecov

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

Package Sidebar

Install

npm i @folo/withcontext

Weekly Downloads

1

Version

0.1.5

License

MIT

Unpacked Size

16.5 kB

Total Files

15

Last publish

Collaborators

  • jimmy02020