Special Route Files in React

From the TanStack Router cheat sheet · File-Based Routing · verified Jul 2026

Special Route Files

Pathless layouts, catch-all, and index routes

typescript
// Pathless Layout (no URL segment)
routes/_auth.tsx          # Layout wrapper
routes/_auth.login.tsx    # /login (uses _auth layout)
routes/_auth.register.tsx # /register (uses _auth layout)

// Catch-all wildcard
routes/$.tsx              # Matches any unmatched route

// Index route
routes/posts/index.tsx    # Exact /posts match
💡 Underscore (_) prefix for pathless layouts
⚡ $.tsx catches unmatched routes
🔍 $.tsx captures all remaining segments (splat), read via params._splat
🎯 index.tsx for exact path matches
layoutspathlesscatch-allwildcards

More React tasks

Back to the full TanStack Router cheat sheet