Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Last active October 2, 2018 04:12
Show Gist options
  • Save StevenJL/9de9ca76974fb878ce6955de54b58fcc to your computer and use it in GitHub Desktop.
Save StevenJL/9de9ca76974fb878ce6955de54b58fcc to your computer and use it in GitHub Desktop.
import shallowEqual from 'shared/shallowEqual';
/*
shallowEqual is a helper function from the React source code:
https://github.com/facebook/react/blob/72434a7686035b4af766ee7d06c070d7f5d6a5f2/packages/shared/shallowEqual.js
*/
shouldComponentUpdate(nextProps, nextState) {
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.State, nextState);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment