Why TanStack Router?
TanStack Router goes beyond traditional routing solutions by providing:- 100% Type-Safe: Full TypeScript support with automatic type inference for routes, params, and search parameters
- Built-in Caching: Intelligent data loading with automatic cache management
- URL State Management: First-class support for search params as application state
- Code-Based or File-Based Routing: Choose the routing style that fits your workflow
- Nested Layouts: Powerful layout composition with route hierarchies
- Data Loaders: Load data before rendering with built-in async support
- Error Handling: Granular error boundaries at the route level
- Path & Search Params: Type-safe params with validation support
Key Features
Type-Safe Navigation
Navigate with confidence using auto-complete and compile-time checks for all routes, params, and search parameters.
Smart Data Loading
Load data before rendering with loaders, built-in caching, and automatic invalidation strategies.
Search Params as State
Use URL search parameters as a single source of truth for application state with validation.
Nested Routes & Layouts
Build complex UI hierarchies with nested routes that share layouts and data.
How It Works
TanStack Router is built around a few core concepts:- Routes - Define your application structure using route definitions
- Router - Create a router instance that manages navigation and state
- RouterProvider - Provide the router to your React tree
- Navigation - Use
Linkcomponents and hooks for type-safe navigation - Data Loading - Define loaders to fetch data before rendering
TanStack Router works seamlessly with popular data fetching libraries like TanStack Query, SWR, and Apollo Client.
Two Routing Approaches
TanStack Router supports both routing paradigms:Code-Based Routing
Define routes programmatically with full control and type inference:File-Based Routing
Organize routes by file structure with automatic route generation:Next Steps
Ready to get started? Choose your path:Installation
Install TanStack Router and set up your project
Quickstart Guide
Build your first router in under 5 minutes
Core Concepts
Dive deep into routing fundamentals
API Reference
Explore the complete API documentation
Community & Support
Join the TanStack community:- GitHub: tanstack/router
- Discord: TanStack Discord
- Twitter: @tan_stack