State and Props
- Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’?
- What is the very first thing to happen in the lifecycle of React?
- Put the following things in the order that they happen:
componentDidMount
, render
, constructor
, componentWillUnmount
, React Updates
constructor
, render
, React Updates
, componentDidMount
, componentWillUnmount
- What does componentDidMount do?
- method invoked immediately after a component is mounted. If you need to load anything using a network request or initialize the DOM, it should go here
- What types of things can you pass in the props?
- things you pass to the constructor of that class
- What is the big difference between props and state?
- state is inside a component, props you pass into the component but handled outside the component
- When do we re-render our application?
- What are some examples of things that we could store in state?
- when you want to change something