Documentation Index
Fetch the complete documentation index at: https://mintlify.com/remix-run/react-router/llms.txt
Use this file to discover all available pages before exploring further.
Picking a Mode
React Router is a multi-strategy router for React. There are three primary ways, or “modes”, to use it in your app. The features available in each mode are additive, so moving from Declarative to Data to Framework simply adds more features at the cost of architectural control.Pick your mode based on how much control or how much help you want from React Router.
The Three Modes
The mode depends on which “top level” router API you’re using:- Declarative
- Data
- Framework
Enables basic routing features like matching URLs to components, navigating around the app, and providing active states.
Mode Comparison
| Feature | Declarative | Data | Framework |
|---|---|---|---|
| URL Matching | ✅ | ✅ | ✅ |
| Navigation | ✅ | ✅ | ✅ |
| Active States | ✅ | ✅ | ✅ |
| Data Loading | ❌ | ✅ | ✅ |
| Actions | ❌ | ✅ | ✅ |
| Pending States | ❌ | ✅ | ✅ |
| Type Safety | ❌ | ❌ | ✅ |
| Code Splitting | ❌ | ❌ | ✅ |
| SSR/SSG | Manual | Manual | Built-in |
| Setup Complexity | Low | Medium | Higher |
| Architectural Control | Full | High | Medium |
Decision Guide
Every mode supports any architecture and deployment target, so the question isn’t really about if you want SSR, SPA, etc. It’s about how much you want to do yourself.<BrowserRouter>Examples By Mode
Can I Switch Modes Later?
Yes! The modes are designed to be upgrade paths:Replace
<BrowserRouter> with createBrowserRouter and <RouterProvider>. You can migrate routes incrementally by adding loaders and actions.Add the Vite plugin and move your route configuration to
routes.ts. You get instant type safety and code splitting.Start simple and upgrade as your needs grow. Each mode builds on the previous one.