useNavigationPrompt does not work with Back button
See original GitHub issueThanks for the work & maintenance you put into this router. I have found an issue where I have a complex form, and need to prompt the user if they try to navigate away with unsaved changes. That works great for events that trigger the beforeunload
event (hard page reload, navigate to a different site outside the SPA) or that use raviger’s navigate
, but it doesn’t work with the browsers Back button.
Has there been any consideration for supporting the interception of the back button within the SPA?
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (23 by maintainers)
Top Results From Across the Web
How to go back to previous route in react-router-dom v6
Try this approach import { useNavigate } from 'react-router-dom'; function YourApp() { const navigate = useNavigate(); return ( <> <button ...
Read more >Preventing going back
Disable back swipe gesture; Override system back button/gesture on Android. However, this approach has many important differences in addition to being less code ......
Read more >Prompt not preventing navigation when clicking browser ...
Prompt not preventing navigation when clicking browser back button or history.goBack() and previous page is external URL #5875.
Read more >Xamarin Forms: Exit prompt is not working when use ...
PushAsync for loading a new page. I am showing a prompt for the exit when a user taps the device back button on...
Read more >Upgrading from v5 v6.6.1
The history library is a direct dependency of v6 (not a peer dep), so you won't ever import or use it directly. Instead,...
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 Free
Top 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
Awesome, thank you so much!
published under 2.3.0