-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Usage of history API in Redirect/onEnter #2624
Comments
What specifically are you trying to do? Our goal for this sort of use case is something like remix-run/history#141, where enhancers just wrap |
So to be more concrete, for named routes, you'd do something like |
One example is pretty much this (we have several apps which share components and different routes):
The That history api change looks like it might do the trick though! Would |
Okay, I see - I think you might just want a separate The history API doesn't really use |
Anyway, I think you'd want a separate |
I've hit a bit of a blocker trying to implement enhancers on the History api which is then used by React Router. It turns out that the
onEnter
callback does not have any access to the history like other first-class consumers, such asLink
, do. This means that we miss out on any of the enhancement we provide to history in redirects.Pointer to usage in
Redirect
: https://github.com/rackt/react-router/blob/master/modules/Redirect.js#L34I can see why having access to
history.pushState
and other side-effect history methods would be dangerous but how about being able to callhistory.createPath
etc? This may also simplify the implementation ofRedirect
.Just wondering if anyone else has come across this limitation or whether it has been considered?
The text was updated successfully, but these errors were encountered: