Skip to content

Commit 69ade99

Browse files
committed
Expand isActive API docs
1 parent 0768baa commit 69ade99

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/API.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ Creates a URL, using the router's config. For example, it will add `#/` in front
199199
##### `isActive(pathOrLoc, indexOnly)`
200200
Returns `true` or `false` depending on if the `pathOrLoc` is active. Will be true for every route in the route branch matched (child route is active, therefore parent is too), unless `indexOnly` is specified, in which case it will only match the exact path.
201201

202+
A route is only considered active if all the URL parameters match, including optional parameters and their presence or absence.
203+
204+
However, only explicitly specified query parameters will be checked. That means that `isActive({ pathname: '/foo', query: { a: 'b' } })` will return `true` when the location is `/foo?a=b&c=d`. To require that a query parameter be absent, specify its value as an explicit `undefined`, e.g. `isActive({ pathname: '/foo', query: { a: 'b', c: undefined } })`, which would be `false` in this example.
205+
202206

203207
## Configuration Components
204208

0 commit comments

Comments
 (0)