Repository navigation
|
Is there a reason why there is an extra NavLink component just to access the |
Answered by
mjackson
Nov 9, 2021
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 |
0 replies
Answer selected by
mjackson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
<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.