-
Notifications
You must be signed in to change notification settings - Fork 47.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
Receive previous state in getDerivedStateFromError #13954
Comments
For a concrete use case, I am trying to refactor the following
(media is rendered by a component that throws a |
I hate to be the person that comments "+1" on an issue, however this one has been open for a bit over a year now and I wonder if we could get some insight from the React team on if this is feature request is likely to make it into React. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Hold your horses, bot, the issue is still relevant and waits for the PR. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
bump |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
bump, literally forever |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
eternabump |
+1 on this feature request |
No reply or anything for 5 years... Kind of boggles the mind |
Do you want to request a feature or report a bug?
This is feature request.
What is the current behavior?
getDerivedStateFromError
hook receiveserror
and doesn't have access tostate
or component instance. This limits possible ways in which it could be used and requires to additionally use other hooks to derive the state:What is the expected behavior?
getDerivedStateFromError
is expected to receive previous state and havesignature to be consistent with related static hook,
getDerivedStateFromProps
. ThisgetDerivedStateFromError
signature is backward compatible with existing one (React 16.6.0).Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16.6.0
The text was updated successfully, but these errors were encountered: