Replace "path" with "location" for SSR + React Router.#514
Replace "path" with "location" for SSR + React Router.#514dustinsoftware merged 1 commit intoreactjs:masterfrom
Conversation
According to the documentation, as well as my testing, React Router expects the URL supplied to `StaticRouter` to be provided via the `location` prop name. React.NET currently supplies this value via the `path` prop name.
|
@gunnim or @dustinsoftware could you please take a look at this? I don't have much experience with ReactRouter. How was this working before? Did it change in a newer Router version? |
|
This change makes the React.NET props more consistent with React Router. Previous use in our sample:
It is a trivial change for any current consumers of React.Router, and it's worth merging for better consistency. |
|
The idea is that you always wrap the StaticRouter, allowing you to render children and target the props shown in the example by dustinsoftware I think I agree this change would be more consistent but I think it's also trivial to continue to support those using the original implementation by simply passing down a location prop as well as the "deprecated" path prop. |
|
Thanks gunnim. I think we should still stick with this change, passing down both may trigger prop-type warnings (such as forbidExtraProps), and migrating should be pretty painless. Since React Router support is pretty new the risk should be pretty low that someone will get blindsided by this change (it gets called out in the release notes) |
|
True, good points :) |
According to the documentation, as well as my testing,
React Router expects the URL supplied to
StaticRouterto be provided via the
locationprop name.React.NET currently supplies this value via the
pathprop name.