Action: Open "https://reactjs.org/docs/react-component.html#the-component-lifecycle" in browser
In this video, we will learn about different life cycle methods available in class based components.
Like the doc says, each component has a life cycle method, which can be used to override to run code.
Action: Open "https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/"
There are basiclly three categories of life cycle methods:
-
Mounting
- These methods are called in the following order when an instance of a component is being created and inserted into the DOM.
constructor
render
componentDidMount
- These methods are called in the following order when an instance of a component is being created and inserted into the DOM.
-
Updating
- An update can be caused by changes to
props
orstate
. These methods are called in the following order when a component is being re-rendered:render
componentDidUpdate
- An update can be caused by changes to
-
Unmounting
- This method is called when a component is being removed from the DOM.
componentWillUnmount
- This method is called when a component is being removed from the DOM.
You can learn more about lifecycles here
Now, we will use these lifecycle methods to initialize and render our tasks. See you in the next video.
There are basiclly three categories of life cycle methods:
-
Mounting
- These methods are called in the following order when an instance of a component is being created and inserted into the DOM.
constructor
render
componentDidMount
- These methods are called in the following order when an instance of a component is being created and inserted into the DOM.
-
Updating
- An update can be caused by changes to
props
orstate
. These methods are called in the following order when a component is being re-rendered:render
componentDidUpdate
- An update can be caused by changes to
-
Unmounting
- This method is called when a component is being removed from the DOM.
componentWillUnmount
- This method is called when a component is being removed from the DOM.
You can learn more about lifecycles here