salvoravida/redux-first-history

state.router.location is not equal to useLocation()

SmoooZ opened this issue · 2 comments

The "Main Goal" section of redux-first-history describes that the following is always true:

//react-router v5 - v6 useLocation() === state.router.location

However a beta of react-router v6 did make sure that useLocation().pathname no longer includes the basename (see https://github.com/remix-run/react-router/releases/tag/v6.0.0-beta.5)
Therefore there is currently a mismatch between useLocation() and state.router.location ; the fact that state.router.location includes the basename does prevent the correct usage of react-router's matchPath() !
For example matchPath("/home", state.router.location.pathname) will always be false if a basename has been set.