Package detail

react-context-toolbox

4Catalyzer143.2kMIT2.0.2

null

readme

@restart/context npm

React context helpers.

Install

npm install @restart/context

Usage

import React from 'react';
import mapContextToProps from '@restart/context/mapContextToProps';

const MyValueContext = React.createContext(null);

function MyComponent(props) {
  /* ... */
}

const MyComponentWithMyValue = mapContextToProps(
  MyValueContext,
  myValue => ({ myValue }),
  MyComponent,
);

const withMyValue = Component =>
  mapContextToProps(
    {
      consumers: MyValueContext,
      mapToProps: myValue => ({ myValue }),
      displayName: `withMyValue(${Component.displayName || Component.name})`,
    },
    Component,
  );

changelog

2.0.2 (2018-12-11)

Bug Fixes

2.0.1 (2018-11-30)

Bug Fixes

2.0.0 (2018-11-30)

Features

  • add types, change published directory (#10) (9886e69)

BREAKING CHANGES

  • remove lib directory

1.2.3 (2018-10-30)

Bug Fixes

  • avoid rendering Context directly warning (fb0262a)

1.2.2 (2018-09-09)

Bug Fixes

  • forwardRef argument count (2a2567b)

1.2.1 (2018-07-27)

Bug Fixes

1.2.0 (2018-07-26)

Features

  • add injectContextAsProp (cf07839)

1.1.0 (2018-05-30)

Features

  • Add transformContext HoC (758daa8)

1.0.0 (2018-05-25)

Features