constructor(props). It will called when the component is being initiated. You should include super(props) at the beginning.
getDerivedStateFromProps(props, state). It will be called right after the constructor, or when the props, or state is updated, or the component's forceUpdate(callback) being called.
shouldComponentUpdate(nextProps, nextState). It will be called after the getDerivedStateFromProps(props, state) triggered by props or state updated only. It should return true if the component need to update, or false otherwise.
render(). By this far, you should know it normal user for creating the component UI by JSX (or another hard way).
-
componentDidMount(). Called after the component constructed, and first rendered.
componentDidUpdate(prevProps, prevState, snapshot). Called after the component is rendered after props, state updated, or forceUpdated() is called.
componentWillUnmount(). Called after a component is unmounted. Happen usually for a parent component unmount a child component.