Skip to main content

React Components

React components for rendering routes, handling errors, and managing navigation.

RouterProvider

The root component that provides router context to your application.

Props

Router
required
The router instance.
RouteComponent
Fallback component when a route has no component.
ErrorRouteComponent
Default error component for all routes.
RouteComponent
Default loading component for all routes.
any
Additional context to merge with router context.

Outlet

Render child route components.

Match

Render a specific route match.

Props

string
required
Route ID to match.
RouteComponent
Component to render.
ErrorRouteComponent
Error component.
RouteComponent
Loading component.

MatchRoute

Conditionally render based on route matching.

Props

string
required
Path to match.
boolean | Record<string, any>
Match with specific params.
boolean
Match pending routes.
boolean
Case-sensitive matching.
(match: RouteMatch | false) => ReactNode
required
Render function.

Matches

Render all current route matches.
Declarative navigation component.

Props

string
required
Destination path.
Record<string, any>
Path parameters.
Search parameters.
string
URL hash.
boolean
Replace history entry.
boolean
Reset scroll position.
Navigation link component.
See Link API for full documentation.

CatchBoundary

Error boundary for routes.

Props

ReactNode
required
Children to wrap.
ErrorRouteComponent
Component to render on error.
() => string
Function to generate reset key.
(error: Error, errorInfo: ErrorInfo) => void
Error handler callback.

ErrorComponent

Default error component.

Props

Error
required
The error object.

ScrollRestoration

Restore scroll position on navigation.

Props

(location) => string
Function to generate scroll restoration key.

Block

Block navigation with confirmation (declarative version of useBlocker).

Props

BlockerFn
required
Function to determine if navigation should be blocked.
boolean
Enable browser beforeunload warning.

Await

Await deferred data in Suspense boundaries.

Props

Promise<T>
required
The deferred promise to await.
(data: T) => ReactNode
required
Render function receiving resolved data.

ClientOnly

Render children only on the client.

Props

() => ReactNode
required
Function returning client-only content.
ReactNode
Content to render on the server.

NotFoundRoute

Handle 404 pages.

CatchNotFound

Catch not found errors.

Scripts

Render route scripts (for SSR).

Examples

Complete Layout

Conditional Rendering

Error Handling

Deferred Data Loading