migrate-react-router

Migrate React Router v6/v7 and Remix v2 applications to the Rango RSC router.

Updated Nov 7, 2025
One-click install
npx skills add https://github.com/rangojs/rango --skill migrate-react-router-rangojs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-react-router
Source: https://github.com/rangojs/rango/tree/main/packages/rangojs-router/skills/migrate-react-router
Command: npx skills add https://github.com/rangojs/rango --skill migrate-react-router-rangojs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Porting a React Router or Remix application to a server-components-first router requires rewriting route definitions, loaders, actions, navigation hooks, and error boundaries, and doing it ad hoc risks broken behavior or leftover compatibility shims. This Skill provides a structured, route-by-route migration path from React Router v6/v7 (framework and library mode) and Remix v2 to @rangojs/router. ## Core Features & Use Cases - Route tree conversion: Maps file-based routes and createBrowserRouter configs to Rango's urls() DSL with path(), layout(), named routes, and splat parameters. - Data and action migration: Converts route-module loader/action exports into server component handlers, createLoader() live data, and "use server" functions with useActionState. - Import replacement tables: Provides exact mappings for Link, Outlet, useNavigate, useLoaderData, useFetcher, defer, meta, and error boundaries, with a strict no-shim policy and a verification checklist. - Use Case: A team with a Remix v2 dashboard app wants server components and type-safe named routes; the Skill walks them through setup, route mapping, data fetching, middleware, metadata, and Cloudflare Workers deployment step by step. ## Quick Start Ask the AI to migrate the React Router app at the given path to @rangojs/router, starting with project setup and route mapping.

Frequently Asked Questions about migrate-react-router

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

FAQPage Schema
How do I migrate a React Router app to Rango?

Work route-by-route, bottom-up: replace the Vite plugin with rango(), convert route configs to the urls() DSL, merge loaders into server component handlers, and convert actions to "use server" functions. Finish by running npx rango generate and verifying no react-router imports remain.

How do I convert React Router loaders and actions to Rango?

Merge each loader into its route's server component handler, which fetches data and renders directly. Convert route actions to "use server" functions called from native forms or useActionState. Use createLoader() only when you need live client-side data or shared loaders across segments.

Does Rango support React Router v7 framework mode and Remix v2?

Yes, the migration covers React Router v7 framework mode (file-based route modules), v7 library mode, v6, and Remix v2. Framework-mode route module exports like loader, action, meta, and ErrorBoundary each map to a specific Rango handler or DSL construct.

What replaces useNavigate and useLoaderData in Rango?

useNavigate becomes useRouter() from @rangojs/router/client with push, replace, and back methods. useLoaderData has no direct equivalent; handlers fetch and render directly, while client components use useLoader() with a registered createLoader() for live data.

Should I shim React Router imports during migration?

No. The guide explicitly forbids mock react-router modules, Vite aliases, or compatibility wrappers because they freeze old semantics and hide unsupported behavior. Replace every react-router or @remix-run import at its call site and remove the packages from package.json.

When should I use clientUrls() instead of server handlers during migration?

Use clientUrls() for route groups whose components are irreducibly hook-heavy client components, or high-navigation-speed surfaces like dashboards. It preserves the React Router route-module shape almost 1:1, including browser-run revalidate predicates, and can be re-migrated to server handlers later.