react-router-data-mode
remix-run/agent-skills · Agent Skill
Build React applications using React Router data mode with createBrowserRouter, loaders, actions, Form, useFetcher, and pending or optimistic UI.
Jump to install ↓Overview
| Publisher | |
|---|---|
| Repository | remix-run/agent-skills ↗ |
| Skill folder | react-router-data-mode |
| Stars | 134 |
| Forks | 4 |
| Bundled files | 8 |
| License | MIT |
| Last updated | June 18, 2026 |
| Links | Skill source ↗ · Repository ↗ |
Mozgi check
What we found in the skill files. Details come with a subscription.
Installation
A skill is a folder with a SKILL.md file. Pick your agent and run the commands in a terminal (macOS, Linux or Git Bash on Windows) from your project root.
Copy the prompt into Claude, Codex or another assistant: it will review the skill and install it for you.
Install the “react-router-data-mode” skill from mozgi.io (https://mozgi.io/skills/remix-run-react-router-data-mode/) for me. 1. Download the archive: https://mozgi.io/skills/remix-run-react-router-data-mode/download If it fails, take the skill folder from the source: https://github.com/remix-run/agent-skills/tree/main/skills/react-router-data-mode 2. Read SKILL.md and the other files. Check the skill is safe: no hidden commands, no sending data elsewhere, no scripts doing something other than described. If anything looks suspicious, stop and tell me. 3. Put the “react-router-data-mode” folder into your agent's skills folder: .claude/skills/ for Claude Code, .agents/skills/ for Codex, .cursor/skills/ for Cursor, .gemini/skills/ for Gemini CLI. Inside the project if we are in one, otherwise in the home folder (~/.claude/skills/ etc.). 4. Make sure <skills folder>/react-router-data-mode/SKILL.md exists. 5. Briefly tell me what this skill does and offer to try it on my task. If you cannot do a step yourself, tell me what to click or type.
git clone --depth 1 --branch main https://github.com/remix-run/agent-skills.git /tmp/agent-skills mkdir -p .claude/skills cp -r /tmp/agent-skills/skills/react-router-data-mode .claude/skills/react-router-data-mode
Restart Claude Code — the skill appears in the list; call it manually with /react-router-data-mode. For all projects use ~/.claude/skills.
git clone --depth 1 --branch main https://github.com/remix-run/agent-skills.git /tmp/agent-skills mkdir -p .agents/skills cp -r /tmp/agent-skills/skills/react-router-data-mode .agents/skills/react-router-data-mode
Codex looks for skills in .agents/skills from the current folder up to the repo root; call one with /skills or $react-router-data-mode. For all projects use ~/.agents/skills.
git clone --depth 1 --branch main https://github.com/remix-run/agent-skills.git /tmp/agent-skills mkdir -p .cursor/skills cp -r /tmp/agent-skills/skills/react-router-data-mode .cursor/skills/react-router-data-mode
Cursor picks the skill up on start; call it with “/” in Agent chat. Cursor also reads .claude/skills and .agents/skills. For all projects use ~/.cursor/skills.
git clone --depth 1 --branch main https://github.com/remix-run/agent-skills.git /tmp/agent-skills mkdir -p .gemini/skills cp -r /tmp/agent-skills/skills/react-router-data-mode .gemini/skills/react-router-data-mode
Gemini CLI offers to activate the skill when a task matches — you approve it. For all projects use ~/.gemini/skills.
Read SKILL.md and any companion files before deciding whether to install. Click a file to preview it.
SKILL.md contents
Original author text · read-onlyReact Router Data Mode
Data mode uses createBrowserRouter and RouterProvider to enable data loading, actions, and pending UI without the framework's Vite plugin. This is ideal for existing React applications that want to add data loading and mutation capabilities.
When to Apply
- Using
createBrowserRouterwith route objects - Loading data with
loaderproperty on routes - Handling mutations with
actionproperty - Navigating with
<Link>,<NavLink>,<Form>,redirect, anduseNavigate - Implementing pending/loading UI states with
useNavigation - Using
useFetcherfor mutations without navigation
References
Load the relevant reference for detailed guidance on the specific API/concept:
| Reference | Use When |
| ---------------------------- | ----------------------------------------- |
| references/routing.md | Configuring routes, nested routes, layout |
| references/route-object.md | Understanding route object properties |
| references/data-loading.md | Loading data with loaders |
| references/actions.md | Handling forms, mutations, validation |
| references/navigation.md | Links, programmatic navigation, redirects |
| references/pending-ui.md | Loading states, optimistic UI |
| references/ssr.md | Server-side rendering with data mode |
Critical Patterns
These are the most important patterns to follow. Load the relevant reference for full details.
Basic Router Setup
import { createBrowserRouter, RouterProvider } from "react-router";
const router = createBrowserRouter([
{
path: "/",
Component: Root,
children: [
{ index: true, Component: Home },
{ path: "about", Component: About },
],
},
]);
ReactDOM.createRoot(root).render(<RouterProvider router={router} />);
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
? 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.
Optimistic UI Pattern
Use fetcher.formData to show expected results immediately:
function FavoriteButton({ itemId, isFavorite }) {
const fetcher = useFetcher();
// Optimistic: use pending form data, fallback to server state
const optimistic = fetcher.formData
? fetcher.formData.get("favorite") === "true"
: isFavorite;
return (
<fetcher.Form method="post" action={`/items/${itemId}/favorite`}>
<input type="hidden" name="favorite" value={String(!optimistic)} />
<button>{optimistic ? "★" : "☆"}</button>
</fetcher.Form>
);
}
See references/pending-ui.md for complete patterns.
Further Documentation
If anything related to React Router is not covered in these references, you can search the official documentation:
https://reactrouter.com/docs
Frequently asked questions
What does the react-router-data-mode skill do?
Build React applications using React Router data mode with createBrowserRouter, loaders, actions, Form, useFetcher, and pending or optimistic UI.
How do I install react-router-data-mode?
Open the “Installation” block on this page and pick your agent — Claude Code, Codex, Cursor or Gemini CLI — for ready-made commands that copy the skill folder to the right place. Or copy the prompt from the “Via assistant” tab and let the assistant review and install the skill.
Which AI models work with react-router-data-mode?
Skills are plain Markdown instructions (the Agent Skills format), so react-router-data-mode works with any agent that reads SKILL.md: Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and more. The model loads the instructions only when a task matches the skill's description.
Is react-router-data-mode free?
The skill is published openly by remix-run under the MIT license. The skill itself costs nothing — you only pay your AI provider for the tokens you use.
Is it safe to install skills?
A skill is a set of instructions your agent will follow, so read SKILL.md and its companion files before installing. Scripts in the skill folder only run if your agent runs them — keep an eye on what it does and do not grant unnecessary permissions.
How is a skill different from an MCP server or a plugin?
An MCP server or plugin gives the model new tools — code that runs and returns a result. A skill gives it knowledge and process: how to approach a task, which steps to follow and what good output looks like. It needs no server or API key.