router-core/not-found-and-errors
Installation
SKILL.md
Not Found and Errors
TanStack Router handles two categories of "not found": unmatched URL paths (automatic) and missing resources like a post that doesn't exist (manual via notFound()). Error boundaries are configured per-route via errorComponent.
CRITICAL: Do NOT use the deprecated
NotFoundRoute. When present,notFound()andnotFoundComponentwill NOT work. Remove it and usenotFoundComponentinstead. CRITICAL:useLoaderDatamay be undefined insidenotFoundComponent. UseuseParams,useSearch, oruseRouteContextinstead.
Not Found Handling
Global 404: notFoundComponent on Root Route
// src/routes/__root.tsx
import { createRootRoute, Outlet, Link } from '@tanstack/react-router'