useMatchRoute with search params #4013
-
I have a route that takes an optional search param The documentation has examples for dynamic route segments, but not for search params. function Component() {
const matchRoute = useMatchRoute()
useEffect(() => {
const matchData = matchRoute({ to: '/users', search: { id: "allow any defined id" }, pending: true });
if (matchData !== false) {
console.info('The /users route with an id is matched and pending', matchData.id);
}
})
return null;
} I want the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
you would rather use |
Beta Was this translation helpful? Give feedback.
you would rather use
useMatches
for this to find the particular match and then read its search params