Skip to main content
Renders a branch of Route elements that best matches the current location. Note that these routes do not participate in data loading, actions, code splitting, or any other route module features.

Type Declaration

Props

React.ReactNode
Nested <Route> elements that define the route configuration.
Partial<Location> | string
The Location to match against. Defaults to the current location. This is useful for testing or when you want to render routes based on a different location.

Example

Basic Usage

Nested Routes

No Match (404)

Multiple Route Sets

Behavior

  • Renders the first <Route> that matches the current location
  • Uses a ranking system to determine the best match when multiple routes could match
  • Returns null if no routes match
  • Static routes (no params) rank higher than dynamic routes (:id)
  • Routes with more segments rank higher than routes with fewer segments

Notes

  • In most modern apps, you’ll use createBrowserRouter instead for data loading, actions, and other advanced features
  • Routes are matched relative to their parent route’s path
  • The * wildcard can be used to match any remaining path segments