reactshouldupdate

Simple util to compare props and state in shouldComponentUpdate

Usage no npm install needed!

<script type="module">
  import reactshouldupdate from 'https://cdn.skypack.dev/reactshouldupdate';
</script>

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']
            }
        });
    }