Skip to main content
Configures an element to render when a pattern matches the current location. It must be rendered within a <Routes> element.

Type Declaration

Props

string
The path pattern to match. Supports URL parameters with : and wildcards with *.
React.ReactNode
The React element to render when this route matches. Mutually exclusive with Component.
React.ComponentType
The React component to render when this route matches. Mutually exclusive with element. Useful for code splitting.
boolean
Whether this is an index route. Index routes render when the parent route’s path matches exactly.
boolean
Whether the path should be case-sensitive. Defaults to false.
RouteLoader
The route loader function. See the loader documentation.
RouteAction
The route action function. See the action documentation.
React.ReactNode
The React element to render if an error occurs in this route. Mutually exclusive with ErrorBoundary.
React.ComponentType
The React component to render if an error occurs in this route. Mutually exclusive with errorElement.
LazyRouteFunction
A function that returns a promise resolving to the route object. Used for code-splitting routes.
any
Any application-specific data. This is useful for breadcrumbs, page titles, etc.
string
A unique identifier for this route. Auto-generated if not provided.
React.ReactNode
Nested route elements.

Examples

Basic Route

Dynamic Segments

Nested Routes

With Data Loading

Splat Routes

Notes

  • A <Route> should only be used as a child of <Routes>
  • Index routes cannot have children
  • Routes are ranked by specificity during matching
  • Use <Outlet /> in parent route elements to render child routes