Skip to content

Instantly share code, notes, and snippets.

@ivancuric
Created May 23, 2017 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivancuric/995b1518bd213fd8d1c8cf31f7e304f4 to your computer and use it in GitHub Desktop.
Save ivancuric/995b1518bd213fd8d1c8cf31f7e304f4 to your computer and use it in GitHub Desktop.
Preact lifecycle methods
class Foo extends Component {
shouldComponentUpdate(nextProps, nextState) {
componentWillReceiveProps(nextProps, nextState) {
this.props // previous props
this.state // previous state
}
componentWillMount() {
componentDidMount() {
componentDidUpdate() {
componentWillUnmount() {
this.props // current
this.state // current
}
render(props, state) {
props===this.props
state===this.state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment