Skip to main content

React Route

React-specific route APIs for creating type-safe routes with components, hooks, and data loading.

createRoute

Create a standard route with React components.

createRootRoute

Create the root route for your application.

createRootRouteWithContext

Create a root route with typed context.

createFileRoute

Create a route from a file-based routing setup.

Route Options (React)

All options from core Route API plus React-specific options.
() => JSX.Element
React component to render for this route.
({ error, reset }) => JSX.Element
Component to render when an error occurs.
() => JSX.Element
Component to render while loading.
() => JSX.Element
Component to render when no child route matches.

Route Hooks

Type-safe hooks for accessing route data.

Route.useLoaderData()

Access loader data with full type safety.

Route.useParams()

Access route params with type safety.

Route.useSearch()

Access validated search params.

Route.useRouteContext()

Access route context.

Route.useNavigate()

Get a navigate function scoped to the route.

Route.useLoaderDeps()

Access loader dependencies.

Lazy Route Loading

Split routes into separate chunks for code splitting.

createLazyRoute

createLazyFileRoute

Route Definition with Lazy Loading

lazyRouteComponent

Lazily load a single route component.

RouteApi

Access route APIs without direct route reference.

getRouteApi

Get a cached RouteApi instance.

Example: Complete Route Setup