react-router-v7
Skill91 starsChanged 5 days agoApache-2.0View on GitHub
React Router v7 best practices for data-driven routing. Use when implementing routes, loaders, actions, Form components, fetchers, navigation guards, protected routes, or URL search params. Triggers on createBrowserRouter, RouterProvider, useLoaderData, useActionData, useFetcher, NavLink, Outlet.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Mindrally/skillstheir own version, first seen Oct 8, 2026
- stonegiantstudio/skillstheir own version, first seen Sep 29, 2026
- robiparvez/claude-code-guidelinestheir own version, first seen Aug 7, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Mindrally/skills★ 275same name
- stonegiantstudio/skills★ 3same name
- robiparvez/claude-code-guidelines★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository85 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- agent-architecture-analysisSkill
- app-intents-code-reviewSkill
- artifact-analysisSkill
- axum-code-reviewSkill
- brainstorm-beagleSkill
- bubbletea-code-reviewSkill
- cloudkit-code-reviewSkill
- elixir-performance-reviewSkill
- elixir-security-reviewSkill
- elixir-writing-docsSkill
- exdoc-configSkill
- exunit-code-reviewSkill
- fastapi-code-reviewSkill
- fetch-pr-feedbackSkill
- ffi-code-reviewSkill
- fix-llm-artifactsSkill
- fowler-refactoringSkill
- gen-test-planSkill
- go-architectSkill
- go-code-reviewSkill
- go-data-persistenceSkill
- go-testing-code-reviewSkill
- healthkit-code-reviewSkill
- humanize-beagleSkill
- improve-docSkill
- ios-animation-code-reviewSkill
- liveview-code-reviewSkill
- llm-artifacts-detectionSkill
- llm-judgeSkill
- macros-code-reviewSkill
- phoenix-code-reviewSkill
- postgres-code-reviewSkill
- prfaq-beagleSkill
- prometheus-go-code-reviewSkill
- pytest-code-reviewSkill
- quick-planSkill
- react-flow-code-reviewSkill
- react-flowSkill
- react-router-code-reviewSkill
- receive-feedbackSkill
- refactor-repoSkill
- resolve-beagleSkill
- respond-pr-feedbackSkill
- review-ai-writingSkill
- review-elixirSkill
- review-frontendSkill
- review-goSkill
- review-iosSkill
- review-llm-artifactsSkill
- review-planSkill
- review-pythonSkill
- review-remix-v2Skill
- review-rustSkill
- review-skillSkill
- review-structureSkill
- review-tuiSkill
- review-verification-protocolSkill
- run-test-planSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 116
Fail →: Prefer loader + revalidation over an effect that mirrors navigation.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Router v7 Best Practices
Quick Reference
Router Setup (Data Mode):
import { createBrowserRouter, RouterProvider } from "react-router";
const router = createBrowserRouter([
{
path: "/",
Component: Root,
ErrorBoundary: RootErrorBoundary,
loader: rootLoader,
children: [
{ index: true, Component: Home },
{ path: "products/:productId", Component: Product, loader: productLoader },
],
},
]);
ReactDOM.createRoot(root).render(<RouterProvider router={router} />);Framework Mode (Vite plugin):
// react-router.config.ts
import type { Config } from "@react-router/dev/config";
export default {
ssr: true,
} satisfies Config;// app/routes.ts
import { index, route, type RouteConfig } from "@react-router/dev/routes";
export default [
index("./routes/home.tsx"),
route("products/:pid", "./routes/product.tsx"),
] satisfies RouteConfig;Route Configuration
Nested Routes with Outlets
createBrowserRouter([
{
path: "/dashboard",
Component: Dashboard,
children: [
{ index: true, Component: DashboardHome },
{ path: "settings", Component: Settings },
],
},
]);
function Dashboard() {
return (
<div>
<h1>Dashboard</h1>
<Outlet /> {/* Renders child routes */}
</div>
);
}Dynamic Segments and Splats
{ path: "teams/:teamId" } // params.teamId
{ path: ":lang?/categories" } // Optional segment
{ path: "files/*" } // Splat: params["*"]Key Decision Points
Form vs Fetcher
Use <Form>: Creating/deleting with URL change, adding to history
Use useFetcher: Inline updates, list operations, popovers - no URL change
Loader vs useEffect
Use loader: Data before render, server-side fetch, automatic revalidation (in Framework Mode, use clientLoader + HydrateFallback for client-only route data needed before render)
Use useEffect: Post-mount user-interaction fetches, timers, or subscriptions
Gates (decision sequencing)
Answer in order. Pass means the condition is true; pick the API on the same line and stop.
<Form> vs useFetcher
- Must the URL or history stack change (bookmark/share, back returns to prior screen)?
- Pass →
<Form>/ routeaction(oruseSubmit+ navigation). Stop. - Fail → Step 2.
- Pass →
- Mutation stays on the same route (inline edit, modal, list row, no address change)?
- Pass →
useFetcher(). Stop. - Fail → Re-check step 1; you may need a dedicated action route or POST to the current URL.
- Pass →
loader vs useEffect
- Is data needed for correct first render (or your intended
<Suspense>boundary) for this route?- Pass →
loader(Framework:clientLoader+HydrateFallbackwhen data must load in the browser before render). Stop. - Fail → Step 2.
- Pass →
- Fetch only after mount from user action, timer, or subscription (not route entry)?
- Pass →
useEffect/ event handlers. Stop. - Fail → Prefer loader + revalidation over an effect that mirrors navigation.
- Pass →
Additional Documentation
- Data Loading: See references/loaders.md for loader patterns, streaming promises,
clientLoader, search params, and revalidation - Mutations: See references/actions.md for actions,
clientAction,Form, fetchers, and validation - Navigation: See references/navigation.md for
Link,NavLink, programmatic nav, and layouts - Advanced: See references/advanced.md for error boundaries, protected routes, middleware (
v8_middleware), and lazy loading
Mode Comparison
| Feature | Framework Mode | Data Mode | Declarative Mode |
| Setup | Vite plugin (react-router.config.ts) | createBrowserRouter | <BrowserRouter> |
| Type Safety | Auto-generated (./+types/<route>) | Manual / LoaderFunctionArgs | Manual |
| SSR Support | Built-in | Manual | Limited |
| Use Case | Full-stack apps | SPAs with control | Simple/legacy |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

