Previous tip (Set multiple parameters in one go with Attribute Splatting)
Next tip (Dynamic components) >>
NavLink gives you more useful navigation links
Use NavLink
if you want to know whether a link is active.
NavLink
works just like a regular a
tag except it will also detect whether its href
matches the current URL.
If it matches then the resulting a
hyperlink will get an active
class (which you can then style to your heart’s content!)
<NavLink href="products"> All Products</NavLink>
// renders (if the current URL// is "/products")<a href="products" class="active"> All Products</a>