router-core/search-params
Installation
SKILL.md
Search Params
TanStack Router treats search params as JSON-first application state. They are automatically parsed from the URL into structured objects (numbers, booleans, arrays, nested objects) and validated via validateSearch on each route.
CRITICAL: When using
zodValidator()and Zod v3, usefallback()from@tanstack/zod-adapter, NOT zod's.catch(). Using.catch()with the zod adapter makes the output typeunknown, destroying type safety. This does not apply to Valibot or ArkType (which use their own fallback mechanisms). It also does not apply to Zod v4, which should use.catch()and not use thezodValidator(). CRITICAL: Types are fully inferred. Never annotate the return ofuseSearch().
Setup: Zod Adapter (Recommended)
npm install zod @tanstack/zod-adapter
// src/routes/products.tsx
import { createFileRoute } from '@tanstack/react-router'
import { z } from 'zod'