Enable navigation blocker based on "next" route #1733
Unanswered
chrisbenincasa
asked this question in
Q&A
Replies: 1 comment
-
There's a PR in progress to implement this: #1790 I'm also needing the same behavior and haven't been able to find any hacky workarounds in the meantime |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I'm wondering if there is a way to recreate the functionality from react-router v6's useBlocker, which can determine blocked state based on the "next" location (about to transition): https://reactrouter.com/en/main/hooks/use-blocker.
I've gotten close with watching changes in location.pathname - but this change seems to fire after the transition has begun and after the blocker has permitted the action. Is there a way to preempt the transition and update the blocking condition based on the upcoming path?
Beta Was this translation helpful? Give feedback.
All reactions