-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocking route changes + Solution #175
Comments
And unfortunately I just realised this will not work when clicking on "Back button" in history :/ |
If anyone is interested, the other solution is VERY, VERY, VERY hacky but it works. you need to hack onto import { globalHistory } from '@reach/router';
const originalNavigate = globalHistory.navigate;
globalHistory.navigate = (...props) => {
// your logic ...
originalNavigate(...props);
} |
@tomitrescak Both solutions only work for |
@wardoost, yup, I ditched Reach router after this finding. Back to react router. Reach router is amazing, but has limited use in more complex applications. |
I wish Reach/Router had both the Edit: Actually the new |
I agree with @tomitrescak that it is unfortunate that react router does not support this. In our organisation we use this a lot that unfortunally i'm now on a project that is deeply dependent on reach router where i now can't implement this very common use case! |
Is there any plan to add the ability to prevent page transitions? |
Any news? |
What about now? |
I faced the same issue and stumbled upon this issue. With further investigation, I found this article (https://reacttraining.com/blog/reach-react-router-future/) where Ryan Florence says Reach Router will not receive any more new features. It is now in maintenance mode and he says the surviving project will be the new 'React Router'. So I would not count on this getting added in the future. |
Hi, in your documentation you mention following:
Well, it is actually quite easy to achieve this with your awesome router with a higher order component:
Of course this solution is prone to your code changes and can be broken in any future release.
The text was updated successfully, but these errors were encountered: