Best-practice guidance for designing, reviewing, debugging, and modernizing TanStack Router routing in React apps, especially file-based route trees, `Link` and `useNavigate`, `validateSearch`, `beforeLoad`, loaders, `notFoundComponent`, auth guards, code splitting, and TanStack Query integration. Use this whenever the user is working with `@tanstack/react-router`, TanStack Start routing, route organization, URL state, or navigation behavior and needs current v1 guidance instead of stale class-based or React Router patterns.
Use this skill for TanStack Router authoring, review, architecture decisions, debugging, and migrations. Start by deciding whether the problem is route structure, URL state, loader orchestration, or data ownership, then keep the route tree typed, the navigation APIs explicit, and the data-loading story consistent.
beforeLoad, loaders, auth guards, redirects, not-found handling, and pending statesNotFoundRoute, or non-reactive router.stateIf the user is mainly solving local component state, form validation, or server-cache ownership, keep Router advice brief and push the problem toward the right abstraction.
from narrowing, and reusable option builders over raw strings and ad hoc URL assembly.references/router-setup-and-route-organization.md
references/navigation-links-and-ux.md
Link, useNavigate, relative navigation, active states, preloading, masking, blocking, and scroll behavior.references/search-params-and-url-state.md
validateSearch, schema adapters, URL-state boundaries, serializers, and search-driven loader keys.references/loaders-deferred-data-and-query-integration.md
beforeLoad, loaders, loaderDeps, Router cache vs Query cache, deferred data, and SSR-oriented Query integration.references/errors-not-found-and-route-context.md
notFoundComponent, route errors, root defaults, and typed router context.references/typing-rendering-and-code-splitting.md
getRouteApi, from and strict, render optimizations, useRouterState, and lazy route setup.NotFoundRoute, or stale React Router habits.Link for user-driven navigation and useNavigate or redirects only for event-driven or lifecycle-driven navigation.linkOptions for reusable navigation objects instead of untyped object literals.loaderDeps that list only the params or search fields the loader actually uses.beforeLoad for auth and route middleware, and loader for data acquisition.notFoundComponent plus notFound() over deprecated NotFoundRoute.createRootRouteWithContext when routes need injected dependencies such as auth or a QueryClient.useRouterState, route hooks, or getRouteApi in components instead of reading router.state directly..lazy.tsx files.This skill is authored from the bundled TanStack Router materials centered on @tanstack/react-router v1.168.10.