JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q39770F
  • License MIT

small HOC for implementing update on props changing

Package Exports

  • react-updating-hoc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-updating-hoc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm npm Dependency Status devDependency Status

react-updating-hoc

$ npm install react-updating-hoc recompose react lodash --save

Usage

import React from 'react';
import updating, { callWhen, callWhenPropsAreUpdated, callWhenPropsAreUpdatedDeeply, callWhen } from 'react-updating-hoc';

const SomeComponent = () => (<div>Hello wordl!</div>);

export default updating(
  callWhen((props) => Boolean(props.some), (props) => {
      // do something useful
  }),
  callWhenPropsAreUpdated([ 'some', 'any' ], (props) => {
      // do something useful
  }),
  callWhenPropsAreUpdatedDeeply([ 'some', 'any' ], (props) => {
      // do something useful
  }),
  callWhenPropsAreUpdated([ 'some.nested.prop', 'any' ], (props) => { // shallow equality check with lodash get
      // do something useful
  }, true),
  callWhenPropsAreUpdatedDeeply([ 'some.nested.prop', 'any' ], (props) => { // deep equality check with lodash get
      // do something useful
  }, true)
)(SomeComponent);