react-router
Original:🇺🇸 English
Translated
Build applications with React Router in Framework, Data, Declarative, and unstable RSC modes. Use when configuring routes, route modules, loaders, actions, forms, fetchers, navigation, pending UI, SSR/SPA/pre-rendering, middleware, URL params/search params, or React Router upgrades.
4installs
Sourceremix-run/react-router
Added on
NPX Install
npx skill4agent add remix-run/react-router react-routerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →React Router
React Router is mode-specific. Before changing an app, identify the mode, load the matching reference, then read the installed docs for the installed package version.
Identify the Mode
Do not apply Framework/Data patterns to a Declarative app unless you are intentionally migrating modes.
Framework Mode
Use Framework Mode guidance when you see:
- in dependencies
@react-router/dev react-router.config.tsapp/routes.ts- and/or
app/entry.server.tsxfilesapp/entry.client.tsx - route modules under
app/routes/ - route exports like ,
loader,action,clientLoader,clientAction,ErrorBoundary,meta, orlinksheaders - imports from
./+types/... - the React Router Vite plugin from
@react-router/dev/vite
Framework examples usually use the default directory, but check for a custom before assuming exact paths.
app/react-router.config.tsappDirectoryThen read .
references/framework-mode.mdData Mode
Use Data Mode guidance when you see:
- ,
createBrowserRouter,createHashRouter, orcreateMemoryRoutercreateStaticRouter <RouterProvider router={router}>- route objects with properties like ,
path,children,loader,action,Component, orErrorBoundarylazy - data APIs without the Framework Vite plugin
Then read .
references/data-mode.mdDeclarative Mode
Use Declarative Mode guidance when you see:
- ,
<BrowserRouter>, or<HashRouter><MemoryRouter> - and
<Routes>JSX route configuration<Route> - route components passed with
element={<Component />} - no data router, no route module convention, and no loaders/actions
Then read .
references/declarative-mode.mdRSC Framework and RSC Data Modes
React Server Components support is unstable and exists in both Framework and Data variants. Use RSC guidance when you see:
unstable_reactRouterRSC@vitejs/plugin-rscunstable_RSCRouteConfig- RSC entry files such as
entry.rsc - ,
ServerComponent,ServerErrorBoundary, orServerLayoutServerHydrateFallback - React directives or boundary packages such as ,
"use client", or"server-only""client-only"
For RSC Framework, read both and .
For RSC Data, read both and .
references/framework-mode.mdreferences/rsc.mdreferences/data-mode.mdreferences/rsc.mdUse Installed Docs as Source of Truth
React Router ships markdown docs in the package so guidance can match the installed version:
txt
node_modules/react-router/docs/Key docs paths:
txt
node_modules/react-router/docs/index.md
node_modules/react-router/docs/start/
node_modules/react-router/docs/how-to/
node_modules/react-router/docs/explanation/
node_modules/react-router/docs/upgrading/When this skill references , read the matching file under . If the installed version does not include local docs, use the repo directory when working inside the React Router repository; in a consuming app, fall back to version-matched website docs.
react-router/docs/...node_modules/react-router/docs/docs/Most docs include a mode marker near the top:
txt
[MODES: framework, data, declarative]Only apply a doc when its mode marker matches the app mode. If a task spans modes, prefer the section or file that matches the current app.
RSC is documented primarily in:
txt
node_modules/react-router/docs/how-to/react-server-components.mdSkill References
Load the relevant reference after identifying the mode:
| Reference | Use When |
|---|---|
| Framework Mode or RSC Framework base behavior |
| Data Mode or RSC Data base behavior |
| Declarative Mode |
| Any unstable RSC app |
Mode Migration Doc Index
If the user explicitly asks to switch modes, read the target mode reference plus the migration-relevant docs:
| Migration | Docs to read |
|---|---|
| Declarative → Data | |
| Declarative/Data → Framework | |
| Framework SPA/SSR/pre-render changes | |
| Future flags/upgrades | |