const { url } = useRouteMatch() doesn't have good equivalent in V6 #9037
Unanswered
yhafez
asked this question in
v5 to v6 Migration
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on migrating to v6 from v5 on a project I'm working on. Currently, we're using the base url destructured from
useRouteMatch()
to set state regarding the currently selected object and to navigate to the next page. The restructured url property returns the url without the parameters that can then be used withrouteMatch
to obtain the parameters using a pattern, but since v6 requires an argument to be passed to useMatch(), there's no way to get the url without the parameters. In this case, the parameters are not named because they're being set by another route in the component, souseParameters
returns the parameters with a key of*
that I can't access. The code looks something like this:The
url
is required in several portions of the code, but I can't access it in v6.location.pathname
for example doesn't give the baseUrl, it includes the parameters, so I can't use it as thepath
key passed to matchPath to determine the id in the params.Beta Was this translation helpful? Give feedback.
All reactions