Skip to content

Instantly share code, notes, and snippets.

@aykutyaman
Created August 23, 2016 09:33
Show Gist options
  • Save aykutyaman/62f636e9d170e7bebd85f92ce7b7f9ae to your computer and use it in GitHub Desktop.
Save aykutyaman/62f636e9d170e7bebd85f92ce7b7f9ae to your computer and use it in GitHub Desktop.
Create deep-equal props that are not shallow-equal
export class SampleComponent extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
return !_.isEqual(this.props, nextProps) ||
!_.isEqual(this.state, nextState);
}
render() {
return <div className={this.props.className}>foo</div>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment