Skip to main content
A declarative Router that stores all entries in memory. Useful for non-browser environments without a DOM API (like testing or React Native).

Type Declaration

Props

string
Application basename for when you can’t deploy to the root of the domain, but a subdirectory.
React.ReactNode
Route components describing your route configuration. Typically contains a <Routes> component with nested <Route> elements.
InitialEntry[]
Initial entries in the in-memory history stack. Each entry can be a string (pathname) or a partial Location object.
number
Index of initialEntries the application should initialize to. Defaults to the last entry.
boolean
Control whether router state updates are internally wrapped in React.startTransition.
  • When left undefined, all router state updates are wrapped in React.startTransition
  • When set to true, Link and Form navigations will be wrapped in React.startTransition and all router state updates are wrapped in React.startTransition
  • When set to false, the router will not leverage React.startTransition on any navigations or state changes.

Example

Testing

Use Cases

  • Testing: Useful for testing components that use routing without a browser
  • React Native: For apps that don’t have a browser history stack
  • Server-side rendering: For controlling the initial location on the server
  • Embedding: When you need multiple isolated routing contexts in a single app