readingnotes

View project on GitHub

State and Props

React lifecycle

  • Based off the diagram, what happens first, the ‘render’ or the ‘componentDidMount’? render then componentDidMount.

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

  • Put the following things in the order that they happen: componentDidMount, render, constructor, componentWillUnmount, React Updates.

  1. constructor
  2. render
  3. componentDidMount
  4. componentWillUnmount
  5. React Updates
  • 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.

ArticleSource


React State Vs Props

  • What types of things can you pass in the props? when you creat a component inside of react and you want to render it you’re goinig to pass it the props that you want to give to it.

  • What is the big difference between props and state? state is handled in the component and you can update it inside the component while props are handled outside the component and must be updated .utside of the component .
  • When do we re-render our application? one that actually changes,whenever there is a change in their state or props.
  • What are some examples of things that we could store in state? use state in form,checkbox any thing handeled by users.

Things I want to know more about:

see this links for more :

State and Lifecycle

Handling Events