-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[v6] [Feature]: Allow to access current route match with hooks #8416
Comments
Just check if |
Ok, that was just an example. The point is to know whether the closest route matches exactly or not. For instance, in the following
|
Well, this is irritating. The API changed again in 6.1.x. Now |
sorry! fixed in #8483, included some extra tests to make sure we do return null |
What is the new or updated feature that you are suggesting?
AFAIK, it is not possible at the moment for a component rendered in a route to determine whether that route matches exactly or not. The hook
useParams
only gives you access to the URL parameters, anduseMatch
forces you to provide full URL pattern, which breaks component isolation.Why should this feature be included?
I'm facing a situation where a component rendered within a route needs to know whether it's a leaf (
end
) or not. In v5, I could useuseRouteMatch
and get access toisExact
. Concept code would be as follows:The text was updated successfully, but these errors were encountered: