Skip to content

Instantly share code, notes, and snippets.

@lwhorton
Created October 4, 2015 16:48
Show Gist options
  • Select an option

  • Save lwhorton/c7781be693642028cd62 to your computer and use it in GitHub Desktop.

Select an option

Save lwhorton/c7781be693642028cd62 to your computer and use it in GitHub Desktop.
React, please let me drive
shouldComponentUpdate: function () {
if (this.state.someState) {
// do stuff
} else {
// do different stuff
}
}
, componentDidMount: function() {
if (this.props.someProp && this.state.someOtherState) {
if (!this.props.anotherProp) {
// more stuff
} else {
// different stuff
}
}
}
, render: function() {
if (this.state.someState) {
// do some stuff
}
if (this.props.someProperty) {
if (this.someOtherState && this.someState) {
// do more stuff
} else {
// do different stuff
}
} else if (this.props.someSecondProperty) {
if (!this.someOtherState) {
// do other different stuff
}
}
... etc.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment