componentWillReceiveProps is marked as deprecated
See original GitHub issueWith React 16.9 the lifecycle function “componentWillReceiveProps” is marked as deprecated will be even removed in React 17.
As you can read here https://fb.me/react-async-component-lifecycle-hooks
But there is a new lifecycle function
static getDerivedStateFromProps(props, state) {
// ...
}
Are there any plans to update the library soon?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
reactjs - why is componentWillReceiveProps deprecated?
componentWillReceiveProps is a synchronous hook. Calling asynchronous function like data fetching inside this hook will need to render in ...
Read more >React.Component
In the event of an error, you can render a fallback UI with componentDidCatch() by calling setState , but this will be deprecated...
Read more >componentWillReceiveProps will be deprecated in the future
The use of componentWillReceiveProps will be deprecated in the future major version of react (17). The current react version throws a ...
Read more >React17, or how to get rid of “componentWillReceiveProps”?
As you may already know, with the release of React 16.3, some of legacy lifecycles were deprecated. One of the biggest lessons we've...
Read more >Deprecated life cycle methods - Learn React with TypeScript 3 ...
There are a few life cycle methods that have been deprecated and renamed in React 17. We don't need to use these anymore—...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As I have pointed out the correct way to change this is to replace “componentWillxxx” with “static getDerivedStateFromProps”.
Not a good idea to ask for context on this implementation as it has been written over 4 years ago so sorry but I can’t help. I would need to investigate possible solutions but I’m short on time to be honest.
I’m happy to review any pull requests and publish the package on my next available spare time. Other than that, unfortunately, you are on your own.