Reading-Notes

Reading Notes

React lifecycle

Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’?

componentDidMount

What is the very first thing to happen in the lifecycle of React?

The mounting phase. This is when constructor, static getDerivedStateFromProps, render, componentDidMount, and UNSAFE_componentWillMount will all happen.

Put the following things in the order that they happen: componentDidMount, render, constructor, componentWillUnmount, React Updates

What does componentDidMount do?

It is a method that is called after the component is rendered.

Video: React State Vs Props

What types of things can you pass in the props?

any type of javascript value including objects, arrays, booleans, and functions.

What is the big difference between props and state?

The key difference between props and state is that state is internal and controlled by the component itself while props are external and controlled by whatever renders the component.

https://stackoverflow.com/questions/27991366/what-is-the-difference-between-state-and-props-in-react#:~:text=The%20key%20difference%20between%20props,by%20whatever%20renders%20the%20component.

Props you pass into the component and state is handled inside of the component.

When do we re-render our application?

When you change the state within the application.

What are some examples of things that we could store in state?

Some information that you want to be able to be manipulated by the user that will then rerender the application, a form is a good example.