Using Prompt component (or useBlocker hook) across multiple router instances #12032
Unanswered
ayush987goyal
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
-
Hi folks, I have a use case where there are multiple react-router instances in an SPA (due to the MicroFrontend structure of the App).
Now when we use the Prompt component to prevent navigating away from unsaved changes it works just fine in context of the same router. When we try to navigate between the routers, the Prompt does not trigger (since I guess it works in context of one router?).
How can we setup the Prompt, through some workaround, to block navigation between routers (either maybe by directly hooking into the history API or something else)?
Beta Was this translation helpful? Give feedback.
All reactions