パッケージの詳細

@restart/context

react-restart1.4mMIT2.1.4

React context helpers.

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,
  );

更新履歴

2.1.4 (2019-03-29)

Bug Fixes

  • Fix build and add README (782718e)

2.1.0 (2019-02-26)

Features

  • add displayName to forwardRef (6e69ad1)

2.0.3 (2019-02-07)

Bug Fixes

  • use inner displayName as default (b518730)

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