You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had come across a use case where we had to warn user before they leave the page to another URL or in App Navigation. It would be great to have a feature to perform some logic before route change is initiated.
Describe the solution you'd like
A router event like beforeRouteChange that triggers a callback function where additional business logic can be executed and the routing can be halted/continued on the basis of a boolean returned by the callback.
I've tried to use window.onbeforeunloadevent, but this does not work in all scenarios (especially in app navigation). It is triggered mostly on closing the tab/browser window.
Another option was a workaround suggested in - #2476 (comment)
The text was updated successfully, but these errors were encountered:
Describe the feature you'd like to request
I had come across a use case where we had to warn user before they leave the page to another URL or in App Navigation. It would be great to have a feature to perform some logic before route change is initiated.
Describe the solution you'd like
A router event like
beforeRouteChange
that triggers a callback function where additional business logic can be executed and the routing can be halted/continued on the basis of a boolean returned by the callback.Another option would be something similar to https://reactrouter.com/core/api/Prompt
Describe alternatives you've considered
I've tried to use window.onbeforeunloadevent, but this does not work in all scenarios (especially in app navigation). It is triggered mostly on closing the tab/browser window.
Another option was a workaround suggested in - #2476 (comment)
The text was updated successfully, but these errors were encountered: