react-router-data-mode

Build React applications with React Router data mode using loaders, actions, and optimistic UI.

3|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/langgenius/due-date-hq-jwl --skill react-router-data-mode-langgenius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-router-data-mode
Source: https://github.com/langgenius/due-date-hq-jwl/tree/main/.agents/skills/react-router-data-mode
Command: npx skills add https://github.com/langgenius/due-date-hq-jwl --skill react-router-data-mode-langgenius

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react-router, and includes references (resource) components.

What problem does it solve? It guides developers through building React applications with React Router's data mode, avoiding common mistakes like manual search-param handling, full-page navigations for inline mutations, and missing loading states. ## Core Features & Use Cases - Route Configuration: Set up createBrowserRouter with nested routes, layouts, index routes, dynamic segments, and error boundaries. - Data Loading & Mutations: Implement loaders, actions, Form components, and useFetcher with automatic revalidation. - Pending & Optimistic UI: Build loading indicators and optimistic updates using useNavigation and fetcher.formData. - Use Case: When adding a favorites toggle to a product page, use the useFetcher optimistic pattern so the star icon updates instantly without a page reload. ## Quick Start Ask the AI to set up a React Router data mode router with a loader, an action, and an optimistic favorite button for your React app.

Frequently Asked Questions about react-router-data-mode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up React Router data mode with createBrowserRouter?

Define routes as objects with path, Component, loader, and action properties, pass them to createBrowserRouter, and render with RouterProvider. This enables data loading, mutations, and pending UI without the framework Vite plugin.

How do I handle form submissions in React Router?

Use the Form component with method="post" to submit to a route action, or use useFetcher for inline mutations without navigation. For search forms, use Form with method="get" to automatically update URL search params.

When should I use useFetcher instead of Form in React Router?

Use useFetcher for inline mutations like likes, ratings, or toggles that should not trigger page navigation. Each fetcher has independent state and its formData property enables optimistic UI updates.

How do I show loading states during navigation in React Router?

Use the useNavigation hook to track navigation state, which returns idle, loading, or submitting. NavLink also exposes isPending for per-link loading indicators while the destination loader runs.

Does React Router data mode support server-side rendering?

Yes, SSR works without the Vite plugin using createStaticHandler and createStaticRouter on the server with StaticRouterProvider, then hydrating on the client with createBrowserRouter and hydrateRoot using shared route definitions.

Why does my React Router loader keep re-running after navigation?

Loaders revalidate automatically after actions complete. Control this behavior with the shouldRevalidate route property, which receives currentUrl, nextUrl, and defaultShouldRevalidate to decide whether revalidation is needed.