React deprecated lifecycle methods - detailed
Here is the list of deprecated methods from react version 16 onwards: componentWillMount → UNSAFE_componentWillMount alternative - getDerivedStateFromProps componentWillReceiveProps → UNSAFE_componentWillReceiveProps getDerivedStateFromProps is going to handle what componentWillReceiveProps and componentDidUpdate did. After either a component is created or when it receives a prop, getDerivedStateFromProps is called to return a new state. componentWillUpdate → UNSAFE_componentWillUpdate alternative - getSnapshotBeforeUpdate The reasons of the deprecation are: All these three methods are frequently used incorrectly and there are better alternatives When asynchronous rendering is implemented in react, incorrect use of these methods can create trouble and interrupting behaviour of error handling could result memory leaks. Although old names can be used until react v.16.9 with a warning, but from v.17 onwards this will not be available, to support asynchronous rendering in react. Here is...