Last active
April 15, 2020 07:11
-
-
Save khalid32/aeab6c40855f537de6ad8565897b7263 to your computer and use it in GitHub Desktop.
This file contains 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
constructor() { | |
super() | |
this.state = {} | |
} | |
static getDerivedStateFromProps(props, state) { | |
// return the new, updated state based upon the props | |
// https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops | |
// https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html | |
} | |
getSnapshotBeforeUpdate() { | |
// create a backup of the current way things are | |
// https://reactjs.org/docs/react-component.html#getsnapshotbeforeupdate | |
} | |
// componentWillMount() { | |
// } | |
componentDidMount() { | |
// GET the data I need to correctly display | |
} | |
// componentWillReceiveProps(nextProps) { | |
// if (nextProps.whatever !== this.props.whatever) { | |
// // do something important here | |
// } | |
// } | |
shouldComponentUpdate(nextProps, nextState) { | |
// return true if want it to update | |
// return false if not | |
} | |
componentDidUpdate(prevProps, prevState, snapshot){ | |
} | |
// componentWillUpdate() { | |
// } | |
componentWillUnmount() { | |
// teardown or cleanup your code before your component disappears | |
// (E.g. remove event listeners) | |
} | |
render() { | |
return ( | |
<div> | |
Code goes here | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment