-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Pass prevState as argument to onLeave #3612
Comments
That's the reason right there. Make use of lifecycle methods as much as possible. In your example, you can move the onChange up to your top level route instead. |
Is it weird that the API is inconsistent here? I do think it would feel more consistent if |
I'm inclined to add One reason you may not want to just use lifecycle hooks there is (as with |
Sure, I'll whip up a PR now. |
This is a little enhancement I'm asking for. Currently, both
onEnter
andonChange
have router state passed as an argument. That allows us doing stuff with router location and parameters. However, it is not the case foronLeave
. Is there any particular reason?Use case example: I'd like to handle socket.io room joining/leaving on the router.
I know this could be handled by the component itself, but I'm questioning why not passing the previous state to the
onLeave
callback, as it might be helpful in some situations.The text was updated successfully, but these errors were encountered: