react-updating-hoc

2.3.1 • Public • Published

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

Package Sidebar

Install

npm i react-updating-hoc

Weekly Downloads

6

Version

2.3.1

License

MIT

Unpacked Size

7.1 kB

Total Files

3

Last publish

Collaborators

  • alxe.master