-
Is there a reason why there is an extra NavLink component just to access the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are other times when you might want a link to be active, such as when the URL contains a certain query parameter. For more complex cases, we provide the hooks for you to build your own |
Beta Was this translation helpful? Give feedback.
<NavLink>
is really just a simple example of how to build a link that knows whether or not it is "active" by matching the beginning of the URL pathname. This is a common case in React Router because nested URL paths often correspond to nested UI.There are other times when you might want a link to be active, such as when the URL contains a certain query parameter. For more complex cases, we provide the hooks for you to build your own
<NavLink>
as demonstrated in this example.