react-router-framework-mode

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.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "react-router-framework-mode" with this command: npx skills add remix-run/agent-skills/remix-run-agent-skills-react-router-framework-mode

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 loader or clientLoader
  • Handling mutations with action or clientAction
  • Navigating with <Link>, <NavLink>, <Form>, redirect, and useNavigate
  • 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:

ReferenceUse When
references/routing.mdConfiguring routes, nested routes, dynamic segments
references/route-modules.mdUnderstanding all route module exports
references/special-files.mdCustomizing root.tsx, adding global nav/footer, fonts
references/data-loading.mdLoading data with loaders, streaming, caching
references/actions.mdHandling forms, mutations, validation
references/navigation.mdLinks, programmatic navigation, redirects
references/pending-ui.mdLoading states, optimistic UI
references/error-handling.mdError boundaries, error reporting
references/rendering-strategies.mdSSR vs SPA vs pre-rendering configuration
references/middleware.mdAdding middleware (requires v7.9.0+)
references/sessions.mdCookie sessions, authentication, protected routes
references/type-safety.mdAuto-generated route types, type imports, type safety

Version Compatibility

Some features require specific React Router versions. Always verify before implementing:

npm list react-router
FeatureMinimum VersionNotes
Middleware7.9.0+Requires v8_middleware flag
Core framework features7.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:

https://reactrouter.com/docs

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

react-router-data-mode

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

react-router-declarative-mode

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

Repository Source
85.9K23Kvercel
Automation

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

Repository Source
60.2K23Kvercel
react-router-framework-mode | V50.AI