Saturday, August 11, 2018

What is React Component Lifecycle

React applications are composed of Component, each component has several “life-cycle methods” that you can override to alter the behavior of the components.

There are some updates to the component life-cycle methods in React 16.3.
3 of the existing component lifecycle methods will depreciate and 2 new methods are introduced.

The following life cycle methods will eventually depreciate. These methods will continue to work till React 17.0

The following life-cycle methods will eventually depreciate
componentWillMount —  please use componentDidMount instead
componentWillUpdate —  please use componentDidUpdate instead
componentWillReceiveProps —  please use the new function, static getDerivedStateFromProps

The following lifecycle methods are introduced in React 16.3
getDerivedStateFromProps
getSnapshotBeforeUpdate

The life-cycle methods called and the order in which they are called varies based on component initialized and updating.

Search Flipkart Products:
Flipkart.com

No comments: