reading-notes
State and Props
React Component Lifecycle Events
Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’?
render
What is the very first thing to happen in the lifecycle of React?
constructor
Put the following things in the order that they happen:
constructor
render
componentDidMount
React Updates
componentWillUnmount
What does componentDidMount do?
a method run after mounting, lets you load anything requiring a network request or initialize the DOM
a “do this stuff after mounting” function
State vs Props
What types of things can you pass in the props?
anything you want passed down from the parent to the child, similar to function arguments
What is the big difference between props and state?
Props are passed into a component (handled outside of component), State is handled inside of the component
When do we re-render our application?
anytime state is changed
What are some examples of things that we could store in state?
anything you are handling inside of the component
form
input element
checkbox
Things I Want To Know More About
state, and how to use it
lifecycle methods
Resources
React Lifecycle
State vs Props - Web Dev Simplified
React Docs - state and lifecycle
React Docs - event handling