Skip to main content

Declarative Mode

Declarative Mode is the simplest way to use React Router. It enables basic routing features like matching URLs to components, navigating around your app, and providing active states - all declared with familiar React components.

Quick Start

Why Declarative Mode?

Declarative Mode is perfect when you:
  • Want the simplest possible routing setup
  • Are migrating from React Router v6
  • Have your own data loading solution
  • Are building a simple SPA
  • Don’t need data loading features built into the router
Declarative Mode gives you routing without the complexity of loaders, actions, or build tools.

Basic Routing

Nested Routes and Layouts

Create layouts with nested routes using <Outlet>:

Dynamic Routes

Handle dynamic URL segments with URL parameters:

Reading URL Data

Common Patterns

Working with Data

In Declarative Mode, you handle data loading yourself:

When to Upgrade

Consider upgrading to Data Mode or Framework Mode if you need:
  • Built-in data loading with loaders
  • Form handling with actions
  • Pending UI states
  • Optimistic UI updates
  • Type safety (Framework Mode)
  • SSR/SSG (Framework Mode)
Declarative Mode is perfect for simple apps, but you can always upgrade to Data or Framework Mode as your needs grow.

Next Steps