Skip to content
Source
Sign inSign up
TanStack/router

feat: provide location in onEnter/onStay/onLeave hooks #3622

Closedjprosevear(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/3622/headopened

Showing 8 changed files with 19 additions and 7 deletions (loading 5).

x
0 of 8 viewed, 8 left
3 additions and 3 deletionsdocs/router/framework/react/api/router/RouteOptionsType.mdModified
View file
@@ -245,19 +245,19 @@
​
### `onEnter` property
​
-- Type: `(match: RouteMatch) => void`
+- Type: `(match: RouteMatch, { location }: { location: ParsedLocation<{}> }) => void`
- Optional
- A function that will be called when a route is matched and loaded after not being matched in the previous location.
​
### `onStay` property
​
-- Type: `(match: RouteMatch) => void`
+- Type: `(match: RouteMatch, { location }: { location: ParsedLocation<{}> }) => void`
- Optional
- A function that will be called when a route is matched and loaded after being matched in the previous location.
​
### `onLeave` property
​
-- Type: `(match: RouteMatch) => void`
+- Type: `(match: RouteMatch, { location }: { location: ParsedLocation<{}> }) => void`
- Optional
- A function that will be called when a route is no longer matched after being matched in the previous location.
​
4 additions and 1 deletionpackages/react-router/src/router.tsModified
View file