Created
August 23, 2016 09:33
-
-
Save aykutyaman/62f636e9d170e7bebd85f92ce7b7f9ae to your computer and use it in GitHub Desktop.
Create deep-equal props that are not shallow-equal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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