From beagle-react
Provides best practices for React Router v7 data-driven routing: loaders, actions, Form vs useFetcher, nested routes, and guards.
How this skill is triggered — by the user, by Claude, or both
Slash command
/beagle-react:react-router-v7The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Router Setup (Data Mode)**:
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):
// routes.ts
import { index, route } from "@react-router/dev/routes";
export default [
index("./home.tsx"),
route("products/:pid", "./product.tsx"),
];
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>
);
}
{ path: "teams/:teamId" } // params.teamId
{ path: ":lang?/categories" } // Optional segment
{ path: "files/*" } // Splat: params["*"]
Use <Form>: Creating/deleting with URL change, adding to history
Use useFetcher: Inline updates, list operations, popovers - no URL change
Use loader: Data before render, server-side fetch, automatic revalidation Use useEffect: Client-only data, user-interaction dependent, subscriptions
Answer in order. Pass means the condition is true; pick the API on the same line and stop.
<Form> vs useFetcher<Form> / route action (or useSubmit + navigation). Stop.useFetcher(). Stop.loader vs useEffect<Suspense> boundary) for this route?
loader (Framework: clientLoader when appropriate). Stop.useEffect / event handlers. Stop.| Feature | Framework Mode | Data Mode | Declarative Mode |
|---|---|---|---|
| Setup | Vite plugin | createBrowserRouter | <BrowserRouter> |
| Type Safety | Auto-generated types | Manual | Manual |
| SSR Support | Built-in | Manual | Limited |
| Use Case | Full-stack apps | SPAs with control | Simple/legacy |
npx claudepluginhub existential-birds/beagle --plugin beagle-reactProvides guidance on React Router v7 for routing, data loading, SSR, and SPA architectures. Covers modes, navigation, loaders, actions, hooks, and form handling.
Provides 55 rules for React Router apps covering loaders, actions, forms, streaming, and route organization. Activates when writing routes, data fetching, form handling, or route layout.
Guides TanStack Router setup in React: file-based routing, type-safe search/path params, data loaders, auth protection, code splitting, SSR, error handling, testing, and bundler config.