talira

TanStack Router

Fully type-safe router for React and Solid apps

open sourceMITfree

TanStack Router is a router for React and Solid apps with fully inferred TypeScript types for routes, path params and navigation. It has nested and layout routes, file-based route generation, route loaders with built-in stale-while-revalidate caching, automatic prefetching, error boundaries, and typed JSON-first search params with schema validation. It's built to work with client-side data caches like TanStack Query, and TanStack Start, a full-stack framework with server rendering, is built on it in the same repository.

Problems it solves

  • get type errors when I link to a route that doesn't exist in my React app
  • keep filter state in the URL's search params with types
  • load data for a route before it renders, with caching

Features

  • fully inferred TypeScript types for routes, params and navigation
  • nested and layout routes with file-based route generation
  • route loaders with built-in stale-while-revalidate caching
  • automatic route prefetching
  • typed JSON-first search params with schema validation
  • React and Solid bindings

Alternatives

The same job

These do what TanStack Router does.

  1. React Router Multi-strategy router for React: use it as a full framework or as a routing library

Compare TanStack Router with the top 3