React-route-dom v6 how to prevent transitions #8341
-
I used Prompt from react-router-dom v5 to prevent transitions to other pages when, for example, form is dirty. It was used to show confirmation dialog for end users. Prompt component is not available anymore in react-router-dom v6.0.2 (at the moment the latest one). Could you please suggest how to prevent transitions now. Which solution should I used? Are you planning to add this component later to v6? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Not sure how this went unanswered, this is a common use case. What I do is create a custom hook to mimic the functionality |
Beta Was this translation helpful? Give feedback.
-
BTW, |
Beta Was this translation helpful? Give feedback.
-
We are facing the same issue. Please give us an instruction of v6 using prompt. |
Beta Was this translation helpful? Give feedback.
-
I found and adapted for me the following solution: https://gist.github.com/rmorse/426ffcc579922a82749934826fa9f743 It uses some undocumented things of |
Beta Was this translation helpful? Give feedback.
-
Bringing prompt back is on the roadmap. Roadmap (view) |
Beta Was this translation helpful? Give feedback.
Bringing prompt back is on the roadmap. https://github.com/orgs/remix-run/projects/5/views/1