You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,7 @@ export default function App() {
144
144
}
145
145
```
146
146
147
-
The `<A>` tag also has an `active` class if its href matches the current location, and `inactive` otherwise. **Note:** By default matching includes locations that are descendents (eg. href `/users` matches locations `/users` and `/users/123`), use the boolean `end` prop to prevent matching these. This is particularly useful for links to the root route `/` which would match everything.
147
+
The `<A>` tag also has an `active` class if its href matches the current location, an `exactActive` class if its href matches the current location exactly and `inactive`class otherwise. **Note:**`active` and `exactActive` are mutually exclusive - there is no class merging! By default matching includes locations that are descendents (eg. href `/users` matches locations `/users` and `/users/123`). `exactActive` is particularly useful for links to the root route `/` which would match everything.
148
148
149
149
150
150
| prop | type | description |
@@ -154,7 +154,8 @@ The `<A>` tag also has an `active` class if its href matches the current locatio
154
154
| replace | boolean | If true, don't add a new entry to the browser history. (By default, the new page will be added to the browser history, so pressing the back button will take you to the previous route.) |
155
155
| state | unknown |[Push this value](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState) to the history stack when navigating ||
156
156
| inactiveClass | string | The class to show when the link is inactive (when the current location doesn't match the link) |
157
-
| activeClass | string | The class to show when the link is active |
157
+
| activeClass | string | The class to show when the link is active, i.e. the current location _starts with_`href`|
158
+
| exactActiveClass | string | The class to show when the link matches the `href` exactly |
158
159
| end | boolean | If `true`, only considers the link to be active when the curent location matches the `href` exactly; if `false`, check if the current location _starts with_`href`|
0 commit comments