1.4.0 • Published 9 years ago

react-log-state-props-diffs v1.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

react-log-state-props-diffs

A decorator to be applied to shouldComponentUpdate for cleanly logging out diffs between old state/new state and old props/new props.

Usage

Run npm i --save-dev react-log-state-props-diffs or yarn add react-log-state-props-diffs.

After that, import it in your JS file:

import logStateAndPropsDiffs from 'react-log-state-props-diffs';

Apply this decorator to shouldComponentUpdate method for the component you're interested in.

Eg.:

@logStateAndPropsDiffs
shouldComponentUpdate() {
    // ... Do whatever checks or logic here
    return true;
}

Other mentions

You will need support to transpile decorators. Use babel for that alongside babel-plugin-transform-decorators-legacy plugin.

Eg. of .babelrc file:

{
    "presets": ["react", "es2015"]
    "plugins": ["transform-decorators-legacy"]
}
1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago