react-router-v6

Document react-router-dom v6 APIs and v6-to-v7 migration guidance.

1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/zenbuapps/zenbu-powers --skill react-router-v6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-router-v6
Source: https://github.com/zenbuapps/zenbu-powers/tree/main/skills/react-router-v6
Command: npx skills add https://github.com/zenbuapps/zenbu-powers --skill react-router-v6

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

React developers need a reliable, up-to-date reference for react-router-dom v6 APIs to implement correct routing and prepare for migrations.

Core Features & Use Cases

  • Authoritative API reference for v6.28.x, covering declarative and data routers, HashRouter, BrowserRouter, createBrowserRouter, RouterProvider, Outlet, useParams, useNavigate, useLocation, loaders/actions, errorElement, and migration guidance.
  • Migration guidance and v6-to-v7 migration notes to smooth upgrades, plus practical usage patterns and code examples.

Quick Start

Install or consult this guide to wire up v6 routing in a project and confirm the project is pinned to react-router-dom ^6.x before migrating to v7.

Frequently Asked Questions about react-router-v6

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up routing with react-router-dom v6 using createBrowserRouter and RouterProvider?

Set up react-router-dom v6 routing by initializing createBrowserRouter with your route definitions and passing it to RouterProvider. This data router API replaces declarative routing patterns and enables advanced features like loaders, actions, and errorElement for robust navigation handling.

What is the difference between declarative routing and data routers in react-router-dom v6?

Declarative routing in react-router-dom v6 uses traditional component hierarchy with BrowserRouter, while data routers use createBrowserRouter and RouterProvider to enable built-in data fetching, mutations via loaders and actions, and automatic error handling through errorElement boundaries.

How do I migrate my react-router-dom project from v6 to v7?

Migrate react-router-dom from v6 to v7 by first pinning your project to v6.28.x, then consulting the built-in v6-to-v7 migration notes to verify compatibility, update deprecated APIs, and adapt your routing structure to the new framework standards.

Can I use HashRouter with react-router-dom v6 data router APIs?

HashRouter in react-router-dom v6 operates within the declarative API paradigm. For data fetching features like loaders and actions, you must transition to createBrowserRouter or createHashRouter to properly utilize the RouterProvider data router pattern.

Why does useNavigate or useParams return undefined in my react-router-dom v6 application?

In react-router-dom v6, useNavigate and useParams return undefined when the component rendering them is not placed inside a Router context or lacks a matching dynamic route segment. Ensure your components are nested within Outlet and properly configured RouterProvider structures.