Docs
- Code Splitting
- Automatic Code Splitting
- Creating a Router
- Outlets
- Navigation
- Router Events
- Path Params
- Search Params
- Link Options
- Custom Links
- Data Loading
- Deferred Data Loading
- External Data Loading
- Data Mutations
- Type Safety
- Type Utilities
- Preloading
- Document Head Management
- Route Masking
- Navigation Blocking
- Custom Search Param Serialization
- History Types
- Router Context
- Not Found Errors
- Authenticated Routes
- Scroll Restoration
- Static Route Data
- SSR
- Render Optimizations
- Quickstart (file-based)
- Quickstart (code-based)
- Basic (file-based)
- Basic (code-based)
- Basic + React Query (file-based)
- Basic + React Query (code-based)
- Basic + SSR (file-based)
- Basic + SSR Streaming (file-based)
- Kitchen Sink (file-based)
- Kitchen Sink (code-based)
- Kitchen Sink + React Query (file-based)
- Kitchen Sink + React Query (code-based)
- Location Masking
- Authenticated Routes
- Scroll Restoration
- Deferred Data
- Navigation Blocking
- View Transitions
- Framer Motion
- With tRPC
- With tRPC + React Query
- Monorepo basic
- Monorepo basic (with lazy loading)
- Monorepo with React Query
- Code Splitting
- Automatic Code Splitting
- Creating a Router
- Outlets
- Navigation
- Router Events
- Path Params
- Search Params
- Link Options
- Custom Links
- Data Loading
- Deferred Data Loading
- External Data Loading
- Data Mutations
- Type Safety
- Type Utilities
- Preloading
- Document Head Management
- Route Masking
- Navigation Blocking
- Custom Search Param Serialization
- History Types
- Router Context
- Not Found Errors
- Authenticated Routes
- Scroll Restoration
- Static Route Data
- SSR
- Render Optimizations
- Quickstart (file-based)
- Quickstart (code-based)
- Basic (file-based)
- Basic (code-based)
- Basic + React Query (file-based)
- Basic + React Query (code-based)
- Basic + SSR (file-based)
- Basic + SSR Streaming (file-based)
- Kitchen Sink (file-based)
- Kitchen Sink (code-based)
- Kitchen Sink + React Query (file-based)
- Kitchen Sink + React Query (code-based)
- Location Masking
- Authenticated Routes
- Scroll Restoration
- Deferred Data
- Navigation Blocking
- View Transitions
- Framer Motion
- With tRPC
- With tRPC + React Query
- Monorepo basic
- Monorepo basic (with lazy loading)
- Monorepo with React Query
TanStackRouter
Type-safe Routing for React and Solid applications
A powerful React router for client-side and full-stack react applications. Fully type-safe APIs, first-class search-params for managing state in the URL and seamless integration with the existing React ecosystem.
Get Startedimport { createRootRoute, createRoute, createRouter, RouterProvider } from '@tanstack/react-router'
const rootRoute = createRootRoute()
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: () => <div>Hello World</div>,
})
const routeTree = rootRoute.addChildren([indexRoute])
const router = createRouter({ routeTree })
export default function App() {
return <RouterProvider router={router} />
}import { createRootRoute, createRoute, createRouter, RouterProvider } from '@tanstack/react-router'
const rootRoute = createRootRoute()
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: () => <div>Hello World</div>,
})
const routeTree = rootRoute.addChildren([indexRoute])
const router = createRouter({ routeTree })
export default function App() {
return <RouterProvider router={router} />
}import { createRootRoute, createRoute, createRouter, RouterProvider } from '@tanstack/solid-router'
const rootRoute = createRootRoute()
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: () => <div>Hello World</div>,
})
const routeTree = rootRoute.addChildren([indexRoute])
const router = createRouter({ routeTree })
export default function App() {
return <RouterProvider router={router} />
}import { createRootRoute, createRoute, createRouter, RouterProvider } from '@tanstack/solid-router'
const rootRoute = createRootRoute()
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: () => <div>Hello World</div>,
})
const routeTree = rootRoute.addChildren([indexRoute])
const router = createRouter({ routeTree })
export default function App() {
return <RouterProvider router={router} />
}Typesafe & powerful, yet familiarly simple
Built-in Data Fetching with Caching
Search Param APIs to make your state-manager jealous
Loved by Developers
See what teams are saying
"The biggest problem with TanStack Router is that once you've worked with it, you'll have a harder time going back to other routing solutions."
"TanStack Router lives and breathes TypeScript - it's meant for it, they are a perfect match."
"I took a few hours to switch to the file-based generation and was very impressed. Then I used auto codesplitting and was blown away. This is absolutely phenomenal!"
"The more I use React + Vite + TanStack Router + TypeScript + TanStack Query, the more I love it."
"I just got Elysia to work with TanStack Router, amazing dx so far.."
"I've been using Tanstack Start for a new project and it's super good. The server functions completely replace the need for TRPC/GraphQL/REST."
"The biggest problem with TanStack Router is that once you've worked with it, you'll have a harder time going back to other routing solutions."
"TanStack Router lives and breathes TypeScript - it's meant for it, they are a perfect match."
"I took a few hours to switch to the file-based generation and was very impressed. Then I used auto codesplitting and was blown away. This is absolutely phenomenal!"
"The more I use React + Vite + TanStack Router + TypeScript + TanStack Query, the more I love it."
"I just got Elysia to work with TanStack Router, amazing dx so far.."
"I've been using Tanstack Start for a new project and it's super good. The server functions completely replace the need for TRPC/GraphQL/REST."
Feature Rich and Lightweight
Take it for a spin!
Create a route, pop in a Router, and start slingin' some code!
