-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling componentWillReceiveProps deprecation in React >= 17 #4154
Comments
I guess we should just use https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops 🤔 |
I'll have to play with it more; offhand it doesn't look like it plays nice with |
|
When using
Do you think this means the use of the new component API stops |
Related to react-hot-loader. We have to update to rhl 5.1 for it to work correctly, but I want to do some testing first |
This was solved, we deprecated the |
The docs currently reference
componentWillReceiveProps
as the recommended way to listen to route changes when using shallow routing:This lifecycle, however, is on the deprecation path; it will stop working as-named in React 17: https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
Given that, we should provide a more future-friendly solution for listening for shallow route changes. Perhaps adding a
popstate
listener incomponentDidMount
. If that seems like the best option I can add it to docs, but opening this ticket for discussion/tracking.The text was updated successfully, but these errors were encountered: