--- name: react-router-v7 description: "React Router v7 framework mode conventions for route modules, data loaders, actions, and progressive enhancement. Use when building file-based routes with loaders/actions, handling form submissions with Form/useFetcher/useSubmit, adding route ErrorBoundary components, revalidating data after mutations, or migrating Remix-style route modules to React Router v7." --- # React Router v7 React Router v7 framework mode unifies routing, data loading, and mutations into route modules, each exporting a `loader`, `action`, `default` component, and `ErrorBoundary` for a single URL segment. ## Workflow for Building a Route Module 1. **Create the route file** — Add a file under `app/routes/` (or your configured routes directory) for the URL segment, using nested folders/files for layouts and dynamic segments. 2. **Export a loader** — Fetch the data the route needs before render; validate route params and search params at the top of the loader. 3. **Export a component** — Read loader data via `useLoaderData()` and render UI; keep the component focused on presentation. 4. **Export an action** — Handle `POST`/`PUT`/`DELETE` submissions from `