Tom Rehnström
Tom Rehnström
@LeCarbonator Yeah I think I overengineered this solution a bit, I got it working in another way!
> we wanted to follow react-router's API for this: > > https://reactrouter.com/en/main/hooks/use-blocker > > can you adjust your PR to match it? > > also, the location should be typesafe...
This implementation should now be providing the `blockerFn` in`useBlocker` with a similar API to the hook in react-router. This also makes the blocker catch backwards navigation using the browser back...
> @tomrehnstrom, are you planning to continue working on this PR? > > Does anyone know a quick and dirty workaround I can apply in the meanwhile? Yes, but have...
For anyone stumbling across the PR and really wants this now, use my fork: https://github.com/tomrehnstrom/router/tree/better-blocker-router Until this can get merged :)
The type safety and type narrowing described by @chorobin is not really implemented, but functionally of it should be complete, have been using this method in prod for quite a...
> @tomrehnstrom thanks for the update still not sure if the API is backwards compatible. can you comment on that please? if it is not backwards compatible can you please...
@ferretwithaberet Sorry for the long wait, would the changes in my latest commit accomplished this?
Cool! I think using setup will be much more useful than having `from`and `to` in the hook args
Anything here I can help with here @schiller-manuel?