react-router-framework-mode
remix-run/agent-skills
Build full-stack React applications with React Router's framework mode, file-based routing, and data loading.
What is react-router-framework-mode?
React Router framework mode provides a full-stack development experience with file-based routing, server-side and client-side rendering strategies, data loading via loaders, mutations via actions, and type-safe route APIs. Use this skill when configuring routes, handling forms and navigation, implementing pending UI states, or setting up authentication and rendering strategies.
- Configure file-based routes with nested routing and dynamic segments
- Load data server-side with loaders or client-side with clientLoader
- Handle form submissions and mutations with actions or clientAction
- Implement navigation with Link, NavLink, Form, and useNavigate
- Build pending/optimistic UI states with useFetcher and loading indicators
- Set up SSR, SPA mode, or pre-rendering via react-router.config.ts
How to install react-router-framework-mode
npx skills add https://github.com/remix-run/agent-skills --skill react-router-framework-mode- React Router v7.0.0 or higher (v7.9.0+ for middleware support)
- Node.js and npm installed
- Basic understanding of React components and hooks
How to use react-router-framework-mode
- 1.Install the skill using: npx skills add https://github.com/remix-run/agent-skills --skill react-router-framework-mode
- 2.Verify your React Router version with: npm list react-router
- 3.Load the relevant reference guide based on your task (routing.md, data-loading.md, actions.md, etc.)
- 4.Follow the critical patterns for forms (use Form method="get" for searches, useFetcher for inline mutations)
- 5.Place global UI like navigation and footer in root.tsx using Outlet for nested routes
- 6.Use loaderData in meta exports and implement error boundaries for error handling
Use cases
- Building a search form that updates URL parameters without page navigation
- Creating an inline favorite/star button that mutates data without full page reload
- Setting up authentication with protected routes and session management
- Configuring a multi-section app with global navigation and section-specific layouts
- Implementing optimistic UI that shows changes immediately while server processes them
- Full-stack React developers
- Teams building server-rendered React applications
- Developers migrating from traditional SPA patterns to framework mode
- Anyone implementing complex routing, data loading, or form handling in React
react-router-framework-mode FAQ
Use <Form> for page-level mutations that should navigate. Use useFetcher for inline mutations (like favoriting) that shouldn't cause page navigation. Search forms should use <Form method="get"> to update URL parameters.
loader runs on the server and can access databases/secrets safely. clientLoader runs in the browser and is useful for client-only data or when you want SPA-like behavior without server roundtrips.
Use the sessions reference to set up cookie-based sessions, then implement protected routes by checking authentication in loaders and redirecting unauthenticated users.
No. Use nested routes for section-specific layouts. Global UI like navigation and footer belongs in root.tsx, not separate layout files.
Middleware requires React Router v7.9.0 or higher with the v8_middleware flag enabled. Check your version with: npm list react-router
Full instructions (SKILL.md)
Source of truth, from remix-run/agent-skills.
name: react-router-framework-mode description: Build full-stack React applications using React Router's framework mode. Use when configuring routes, working with loaders and actions, handling forms, handling navigation, pending/optimistic UI, error boundaries, or working with react-router.config.ts or other react router conventions. license: MIT
React Router Framework Mode
Framework mode is React Router's full-stack development experience with file-based routing, server-side, client-side, and static rendering strategies, data loading and mutations, and type-safe route module API.
When to Apply
- Configuring new routes (
app/routes.ts) - Loading data with
loaderorclientLoader - Handling mutations with
actionorclientAction - Navigating with
<Link>,<NavLink>,<Form>,redirect, anduseNavigate - Implementing pending/loading UI states
- Configuring SSR, SPA mode, or pre-rendering (
react-router.config.ts) - Implementing authentication
References
Load the relevant reference for detailed guidance on the specific API/concept:
| Reference | Use When |
|---|---|
references/routing.md | Configuring routes, nested routes, dynamic segments |
references/route-modules.md | Understanding all route module exports |
references/special-files.md | Customizing root.tsx, adding global nav/footer, fonts |
references/data-loading.md | Loading data with loaders, streaming, caching |
references/actions.md | Handling forms, mutations, validation |
references/navigation.md | Links, programmatic navigation, redirects |
references/pending-ui.md | Loading states, optimistic UI |
references/error-handling.md | Error boundaries, error reporting |
references/rendering-strategies.md | SSR vs SPA vs pre-rendering configuration |
references/middleware.md | Adding middleware (requires v7.9.0+) |
references/sessions.md | Cookie sessions, authentication, protected routes |
references/type-safety.md | Auto-generated route types, type imports, type safety |
Version Compatibility
Some features require specific React Router versions. Always verify before implementing:
npm list react-router
| Feature | Minimum Version | Notes |
|---|---|---|
| Middleware | 7.9.0+ | Requires v8_middleware flag |
| Core framework features | 7.0.0+ | loaders, actions, Form, etc. |
Critical Patterns
These are the most important patterns to follow. Load the relevant reference for full details.
Forms & Mutations
Search forms - use <Form method="get">, NOT onSubmit with setSearchParams:
// ✅ Correct
<Form method="get">
<input name="q" />
</Form>
// ❌ Wrong - don't manually handle search params
<form onSubmit={(e) => { e.preventDefault(); setSearchParams(...) }}>
Inline mutations - use useFetcher, NOT <Form> (which causes page navigation):
const fetcher = useFetcher();
const optimistic = fetcher.formData?.get("favorite") === "true" ?? isFavorite;
<fetcher.Form method="post" action={`/favorites/${id}`}>
<button>{optimistic ? "★" : "☆"}</button>
</fetcher.Form>;
See references/actions.md for complete patterns.
Layouts
Global UI belongs in root.tsx - don't create separate layout files for nav/footer:
// app/root.tsx - add navigation, footer, providers here
export default function App() {
return (
<div>
<nav>...</nav>
<Outlet />
<footer>...</footer>
</div>
);
}
Use nested routes for section-specific layouts. See references/routing.md.
Route Module Exports
meta uses loaderData, not deprecated data:
// ✅ Correct
export function meta({ loaderData }: Route.MetaArgs) { ... }
// ❌ Wrong - `data` is deprecated
export function meta({ data }: Route.MetaArgs) { ... }
See references/route-modules.md for all exports.
Further Documentation
If anything related to React Router is not covered in these references, you can search the official documentation:
Related skills
More from remix-run/agent-skills and the wider catalog.

react-router-data-mode
Build React applications using React Router's data mode with createBrowserRouter and RouterProvider. Use when working with route objects, loaders, actions, Form, useFetcher, or pending/optimistic UI without the Vite plugin.

playwriter
Control your Chrome browser with Playwright code in a stateful sandbox—automate JS-heavy sites without launching a new browser.

add-expert
Add a new expert to the Remotion experts page

add-sfx
Add a new sound effect to @remotion/sfx library

docs-demo
Create interactive Remotion composition demos for documentation pages.

make-pr
Open a pull request for the current feature