Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
remix-run avatar

React Router Data Mode

  • 678 installs
  • 138 repo stars
  • Updated June 18, 2026
  • remix-run/agent-skills

react-router-data-mode is a frontend development agent skill that guides coding agents through React Router actions, forms, fetchers, and server-side mutations without manual fetch boilerplate.

About

react-router-data-mode is an agent skill from remix-run/agent-skills covering React Router actions and form handling for data mutations. The skill documents when to use Form method get for search filters, action-based mutations for create/update/delete, useFetcher for non-navigating submissions, useSubmit, useActionData, and automatic loader revalidation after actions complete. Developers reach for react-router-data-mode when building React Router v7 data-mode apps and want agents to wire forms and mutations correctly instead of scattering fetch calls across components. Tags include action, Form, useFetcher, useSubmit, useActionData, mutations, and validation. Use it during feature work where URL search params, optimistic UI, or server actions must follow React Router conventions.

  • Decision matrix for GET search forms vs POST mutations vs `useFetcher` inline edits
  • Recommends `useFetcher` as the default for smoother mutations and optimistic UX
  • Documents anti-patterns such as manual `useSearchParams` submit handlers for search
  • Explains automatic loader revalidation after actions complete
  • Maps mutations with navigation vs without navigation to the right Router APIs

React Router Data Mode by the numbers

  • 678 all-time installs (skills.sh)
  • +15 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #513 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/remix-run/agent-skills --skill react-router-data-mode

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs678
repo stars138
Security audit3 / 3 scanners passed
Last updatedJune 18, 2026
Repositoryremix-run/agent-skills

How do React Router actions handle form mutations?

Guide your coding agent through React Router actions, forms, fetchers, and server-side mutations without manual fetch boilerplate.

Who is it for?

React Router developers using data-mode who want agent-guided action, Form, and useFetcher patterns instead of hand-written fetch logic in components.

Skip if: Developers on Next.js App Router server actions, plain React with React Query only, or React Router apps not using data-mode loaders and actions.

When should I use this skill?

User asks about React Router actions, Form method get/post, useFetcher mutations, useActionData, or loader revalidation after form submit.

What you get

Action functions, Form components, fetcher hooks, validated mutation handlers, and auto-revalidated loaders after submissions.

  • Action handler functions
  • Form and fetcher components
  • Validated mutation flows

By the numbers

  • Covers 6 core APIs: action, Form, useFetcher, useSubmit, useActionData, and loader revalidation
  • Includes pattern table for search filters, mutations, and fetcher use cases

Files

SKILL.mdMarkdownGitHub ↗

React 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 createBrowserRouter with route objects
  • Loading data with loader property on routes
  • Handling mutations with action property
  • Navigating with <Link>, <NavLink>, <Form>, redirect, and useNavigate
  • Implementing pending/loading UI states with useNavigation
  • Using useFetcher for mutations without navigation

References

Load the relevant reference for detailed guidance on the specific API/concept:

ReferenceUse When
references/routing.mdConfiguring routes, nested routes, layout
references/route-object.mdUnderstanding route object properties
references/data-loading.mdLoading data with loaders
references/actions.mdHandling forms, mutations, validation
references/navigation.mdLinks, programmatic navigation, redirects
references/pending-ui.mdLoading states, optimistic UI
references/ssr.mdServer-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

Related skills

How it compares

Pick this over generic React form skills when the stack uses React Router data-mode with actions and automatic loader revalidation.

FAQ

What patterns does react-router-data-mode cover?

react-router-data-mode covers React Router actions, Form submissions, useFetcher, useSubmit, and useActionData for mutations. After an action completes, loaders on the page automatically revalidate per the skill guidance.

When should I use useFetcher vs Form in React Router?

react-router-data-mode recommends Form method get for search and filter forms that update URL params, and useFetcher when mutations should not trigger navigation. Action-based POST handles create, update, and delete operations.

Is React Router Data Mode safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.