@@ -14,6 +14,15 @@ import type { ErrorComponentProps } from '@tanstack/react-router'
14
14
import './styles.css'
15
15
16
16
const rootRoute = createRootRoute ( {
17
+ onEnter : ( match , { location } ) => {
18
+ console . log ( 'Entering root route' , match , location . pathname )
19
+ } ,
20
+ onStay : ( match , { location } ) => {
21
+ console . log ( 'Staying root route' , match , location . pathname )
22
+ } ,
23
+ onLeave : ( match , { location } ) => {
24
+ console . log ( 'Leaving root route' , match , location . pathname )
25
+ } ,
17
26
component : RootComponent ,
18
27
notFoundComponent : ( ) => {
19
28
return (
@@ -190,6 +199,15 @@ function PathlessLayoutAComponent() {
190
199
}
191
200
192
201
const pathlessLayoutBRoute = createRoute ( {
202
+ onEnter : ( match , { location } ) => {
203
+ console . log ( 'Entering route-b route' , match , location . pathname )
204
+ } ,
205
+ onStay : ( match , { location } ) => {
206
+ console . log ( 'Staying route-b route' , match , location . pathname )
207
+ } ,
208
+ onLeave : ( match , { location } ) => {
209
+ console . log ( 'Leaving route-b route' , match , location . pathname )
210
+ } ,
193
211
getParentRoute : ( ) => nestedPathlessLayout2Route ,
194
212
path : '/route-b' ,
195
213
component : PathlessLayoutBComponent ,
0 commit comments