-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Allow a router prop to take priority over context prop. #3729
Conversation
withRouter should allow a router prop specified on a wrapped component to be used instead of the router in context; this pattern is more flexible, avoids overwriting explicitly set tests, and makes testing components wrapped by withRouter more simple.
Does the React Redux |
Yes, see here. |
Does not appear to do this: https://github.com/reactjs/react-redux/blob/v4.4.5/src/components/connect.js#L12-L16 |
For the store though... if you look at the version on Well, I guess we can source them all from the same router. |
The |
I see what you mean about the priority for That said, this is potentially a BC problem (if someone is currently specifying a router prop it's being ignored; that won't be the case after this change) and it's ultimately easy to roll my own |
I think this is fine. We'll need to separately backport (forwardport?) to the LGTM. |
Thanks! |
withRouter should allow a router prop specified on a wrapped component
to be used instead of the router in context; this pattern is more
flexible, avoids overwriting explicitly set props, and makes testing
components wrapped by withRouter more simple.