Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

reactshouldupdate

Exilz10MIT1.0.1

Simple util to compare props and state in shouldComponentUpdate

react, shouldcomponentupdate, props, state, compare, deep

readme

React componentShouldUpdate util

Usage


import checkDiff from 'reactshouldupdate';

    shouldComponentUpdate (nextProps, nextState) {
        return checkUpdate({
            props: {
                next: nextProps,
                current: this.props,
                checks: ['stateProps1', 'stateProps2']
            }
            state: {
                next: nextState,
                current: this.state,
                checks: ['stateKey1', 'stateKey2']
            }
        });
    }