-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Adding middleware to <RouterContext/> #3641
Comments
I think that might be the solution:
export default function useScroll(shouldUpdateScroll) {
return {
renderRouterContext: (child, props) => (
<ScrollBehaviorContainer
shouldUpdateScroll={shouldUpdateScroll}
routerProps={props}
>
{child}
</ScrollBehaviorContainer>
),
};
} And <ScrollBehaviorContainer
shouldUpdateScroll={shouldUpdateScroll}
routerProps={routerContextProps}>
<RouterContext {...routerContextProps}/>
</ScrollBehaviorContainer> Do you think that would be a suitable solution? |
This is a redux-router issue, not a React Router issue. If redux-router provides a different API, it's up to them to expose a way to use router middlewares. |
@halt-hammerzeit It really seems to be a |
@perrin4869 Thanks, the answer you provided is similar to the way I went yesterday. And it seems to work. Forgot to post a link here for googlers: The key question was "How to add
Maybe the formulation of the question doesn't make a lot of sense for a |
redux-router
uses<RouterContext/>
to make it workhttps://github.com/acdlite/redux-router/blob/master/src/ReduxRouter.js#L106
scroll-behaviour
tells in its docs to add a middleware to therender
propertyhttps://github.com/taion/react-router-scroll
But I don't see
render
property on<RouterContext/>
.Is there such a property I can set to make it work?
In
applyRouterMiddleware
source code I can see that it just (?) renders<RouterContext/>
Does it mean that to make
<RouterContext/>
work with middleware therender
property is not required, and instead<RouterContext/>
may just (?) be wrapped (?) with the middleware of interest?The text was updated successfully, but these errors were encountered: