ReactJS: componentDidMount, componentWillUnmount



  • Please explain two things to amateur:

    componentDidMount
    componentWillUnmount
    

    I understand correctly, the first one goes after the first successful brand, and the second before the virtual DOM element is removed?

    Comment, if it's not too hard, on.



  • Method componentDidMount Called immediately after the first delineation of the component. In this method, asynchronous queries, initialization of timers, etc. are usually made. References are also available from this point of view refs

    Method componentWillUnmount is performed immediately prior to the removal of the DOM component. There is a different kind of cleaning: removal of any elements, stop of timers, interruption of requests to the server if they have not yet been completed.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2