Skip to content

Instantly share code, notes, and snippets.

@chris-burgin
Created January 31, 2018 18:48
Show Gist options
  • Save chris-burgin/38e93fe5a56362b5d132d9a613f4af07 to your computer and use it in GitHub Desktop.
Save chris-burgin/38e93fe5a56362b5d132d9a613f4af07 to your computer and use it in GitHub Desktop.
A breakdown of the MessageComponent that shows an example using shouldComponentUpdate()
class Message extends Component {
shouldComponentUpdate(nextProps) {
if (this.props.message === nextProps.message) {
return false
}
return true
}
render() {
return <li style={{ margin: "10px" }}> {this.props.message} </li>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment