1.Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’?
Render happens first.
2.What is the very first thing to happen in the lifecycle of React?
The constructor is created.
3.Put the following things in the order that they happen: componentDidMount
, render
, constructor
, componentWillUnmount
, React Updates
constructor
render
componentDidMount
React Updates
componentWillUnmount
4.What does componentDidMount
do?
This method is 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. This method is a good place to set up any subscriptions.
1.What types of things can you pass in the props?
Props are used to pass in various types of data as arguments to a component.
2.What is the big difference between props and state?
State is handled inside a component and you can update it inside the component, where props are passed into a component and handled outside of the component and must be updated outside the component.
3.When do we re-render our application?
When you change the state inside an application or pass in new props it will re-render that section of the application.
4.What are some examples of things that we could store in state?
Counters (votes/likes/etc), forms (input elements/checkboxes/etc), or anything that will be updated inside of the component.
React Docs - State and Lifecycle
React Tutorial through ‘Developer Tools’
React Bootstrap Documentation Boootstrap Cheatsheet