Mounting components call these methods (dans l’ordre de traitement)

  • componentWillMount
  • render
  • componentDidMount

updating components methods (dans l’ordre de traitement)

  • componentWillReceiveProps(nextProps) // moyen de bypasser le render, et de contrôler le props
  • shouldComponentUpdate(nextProps, nextState) (return boolean) // contrôler si un composant devrait rendre ou pas
  • componentWillUpdate(nextProps, nextState)
    • The main purpose of componentWillUpdate is to interact with things outside of the React architecture. If you need to do non-React setup before a component renders, such as checking the window size or interacting with an API, then componentWillUpdate is a good place to do that.
  • render
  • componentDidUpdate(prevProps, prevState)
    • componentDidUpdate is usually used for interacting with things outside of the React environment, like the browser or APIs. It’s similar to componentWillUpdate in that way, except that it gets called after render instead of before.
  • componentWillUnmount(prevProps, prevState)
    • If a component initiates any methods that require cleanup, then componentWillUnmount is where you should put that cleanup.