How can I implement the prompt functionality when I am using BrowserRouter as my Router in react-router v6? #9598
Unanswered
Akshay-21-crypto
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Recently I have upgraded to react router version 6.23.1. At few places in my application, I have used Prompt to display a modal to the user before navigating to a different page, when there are some unsaved changes in the current page. Since, Prompt was removed in version 6, this feature was breaking. After going through the latest docs, found that useBlocker can be used to implement the same behavior. But the problem is useBlocker can only be used when data routers are being used. In my application, I am using component. So I can't use useBlocker. How can I implement the blocking behavior now?
Beta Was this translation helpful? Give feedback.
All reactions