The componentDidUpdate lifecycle method will be called when state changes.
we can compare provided state and props values with current state and props to determine if something meaningful changed.
componentDidUpdate(object prevProps, object prevState)
The previous releases of ReactJS also uses componentWillUpdate(object nextProps, object nextState) for state changes.
It has been deprecated in latest releases.