The render phase happens first before componentDidMount
Mounting is the first thing to happen in the component lifecycle. Mounting includes the constructor, getDerivedStateFromProps, render, React updates DOM and refs, then componentDidMount.
constructor, render, react updates, componentDidMount, then componentWillUnmount
After a component is mounted, componentDidMount() is invoked. In componentDidMount(), we use anything that uses a network request(API Request), initalizes the DOM and sparingly setState. We can set up ‘subscriptions’ in here and unsubscribeusing componentWillUnmount().
They are like arguments to a function, we can pass things we want to initialize our component to such as initial counters, titles, values.
With props you pass it into the component and it is handled/updated outside of the component,
state is handled inside of the component and updated inside.
When state changes inside of application, its going to re-render that component of your application.
We want to re-render the application when something needs to change based on user input.
Some examples are counters, forms, input elements and things that need to be updated by the user.
Updating components
Seeing the lifecycle live and if
Understanding how to use state and props and how to modify them
References