TanStack Router

Configure TanStack Router file-based routes with loaders and dynamic segments.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/captjay98/livestockai --skill tanstack-router-captjay98
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TanStack Router
Source: https://github.com/captjay98/livestockai/tree/main/.kiro/skills/tanstack-router
Command: npx skills add https://github.com/captjay98/livestockai --skill tanstack-router-captjay98

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Router enables type-safe, file-based routing and SSR-friendly navigation in LivestockAI, reducing boilerplate and routing errors.

Core Features & Use Cases

  • File-based routes under app/routes with __root.tsx, index.tsx, _auth.tsx, and nested routes for dashboards, farms, batches, and settings.
  • Use loaders to fetch data on the server, avoid useEffect for data-loading, and support dynamic routes with $paramName.
  • Declarative navigation and route composition with createFileRoute and the router API, including authentication layouts and skeletons for loading states.

Quick Start

Configure TanStack Router with createFileRoute and protected routes to bootstrap your app routing.

Frequently Asked Questions about TanStack Router

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up type-safe file-based routing in a React application?

Type-safe file-based routing is set up by defining routes under an app/routes directory using __root.tsx and nested files, then initializing navigation with createFileRoute to ensure compile-time type validation.

Can I use loaders for server-side data fetching instead of useEffect?

Loaders enable server-side data fetching by executing before route rendering, allowing you to avoid useEffect for data-loading and support SSR-compatible navigation directly within the route definition.

How do I structure authentication layouts for protected routes?

Authentication layouts are structured using pathless route files like _auth.tsx, wrapping protected nested routes to enforce auth guards before rendering dashboard, settings, or batch components.

What is the best way to handle dynamic segments for farms and batches?

Dynamic segments for farms and batches are handled using $paramName route files, passing URL parameters type-safely to loaders and components to fetch entity-specific data without runtime parsing errors.

Does TanStack Router support SSR-friendly navigation?

SSR-friendly navigation is supported natively by pairing loaders with the router API to fetch data on the server, avoiding client-side hydration mismatches and reducing boilerplate.

Why should I use file-based routing over manual route configuration?

File-based routing eliminates manual route configuration boilerplate by co-locating route files with components, automatically resolving nested routes and reducing routing errors through type inference.