Link Search Menu Expand Document

Reading

React lifecycle

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

  • render() will run first followed by componentDidMount()

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

  • The first thing to happen in the lifecycle of react is mounting

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?

  • The componentDidMount() method allows us to execute the React code when the component is already placed in the DOM (Document Object Model). This method is called during the Mounting phase of the React Life-cycle i.e after the component is rendered. Geeks for Geeks ReactJS

Videos

React State Vs Props

What types of things can you pass in the props?

  • They are for items that you would pass to a function

What is the big difference between props and state?

  • States are inside of the component. Props (outside of the component) are passed in to a component and states are handled inside of components

When do we re-render our application?

  • When you change a state of your component, it will need to be re-rendered

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

  • Items that we would like to be dynamic / updatable outside of the component

Bookmark and Review