reading-notes

Read 301-2

These are very important bits of information regarding React and how it works. The workflow of this system is something that must be understood in order to unlock the ultimate power available in React.

Reading

React lifecycle

  1. Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’?
    • render
  2. What is the very first thing to happen in the lifecycle of React?
    • mounting
  3. Put the following things in the order that they happen: componentDidMount, render, constructor, componentWillUnmount, React Updates
    • constructor, render, React Updates, componentDidMount, componentWillUnmount
  4. What does componentDidMount do?
    • used to load anything using a network request or initializing the DOM. Good place to set up subscriptions but don’t forget to use componentWillUnmount() to unsubscribe.

Videos

React State Vs Props

  1. What types of things can you pass in the props?
    • basically all the data types like booleans, numbers, strings and other stuff like objects, functions, and arrays. Components use these to render dynamic content
  2. What is the big difference between props and state?
    • props are external to a component, they are passed into the component
    • state is internal to a component and updated internally to the component
  3. When do we re-render our application?
    • when you change the state of the application or a section of the application and it causes the application to re-render
  4. What are some examples of things that we could store in state?
    • a counter, state stores things that need to updated based on something the user has done
      • this could be useful inside of a form as well
    • this causes the application to re-render/update correctly

Things I want to know more about…

Just clear lecture examples of everything.