TanStackT
TanStack4mo ago
1 reply
brilliant-lime

Default child route for layout route

I have a layout route that renders some tabs that switch between several child routes. Let's say we have /parent, then /parent/tab1 and /parent/tab2.
Now, I don't want the index route to ever be rendered - the user should be redirected to /parent/tab1 by default if they attempt to visit /parent. I can achieve this by throwing a redirect in the
beforeLoad
and looking at the location there, but this is not typesafe.

Can I find out if no child route is matched? Or can I provide a fallback for the Outlet? I've looked at the documentation and didn't find anything.
Was this page helpful?