componentDidMount will be invoked after the component initially renders on the screen. This is a great method if you need certain functionality to fire as soon as the component is in the viewport.
componentDidUpdate won't fire after the initial render, but on each render after. Remember, render will be re-invoked after any change in state or props.
componentDidUpdate(prevProps, prevState){
//componentDidUpdate optionally takes in a reference to the
//previous props and state objects to make comparisons if needed
alert(`New username is ${this.state.username}`)
}
changeUsername = () => {
this.setState({
username: 'Bob Ross'
})
}
render(){
<div>Display Here</div>
}