Read loader, action, and navigation data with the React Router data hooks.
Once a loader or action runs, React Router stores the result on the matching route. You read it with a hook. Each hook is designed for a specific scope - the current route, another route by id, the whole matched chain, or the current navigation state.
| Hook | Scope | Common use |
|---|---|---|
| useLoaderData() | Current route | Page-level data from a loader |
| useActionData() | Current route | Form submission result |
| useRouteLoaderData(id) | A specific route by id | Parent loader data in a child |
| useMatches() | Every matched route | Breadcrumbs, analytics |
| useNavigation() | Global navigation state | Pending/loading states |
react-router-dom inside files under src/app/. In .mdx and .md files you must import them explicitly.Returns the resolved value of the current route's loader. Use this inside the page component that defines the loader.
Returns the resolved value of the current route's action. It is undefined until the action has run at least once.
Returns the loader value of a route by its route id. Use this in a child component that needs the loader data from a parent layout without re-fetching it.
src/app/dashboard/layout.tsx is available under the id dashboard.Returns an array of every route in the current matched chain, each with its handle and data. Use this for breadcrumbs, analytics, or any component that needs to know the full URL hierarchy.
Fetch data before a route renders.
Handle form submissions and mutations.
Catch render errors and show a fallback UI.
Show a fallback while pages and layouts load.
Create your first pages and wrap them in shared layouts.
Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.
Read loader, action, and navigation data with the React Router data hooks.
Once a loader or action runs, React Router stores the result on the matching route. You read it with a hook. Each hook is designed for a specific scope - the current route, another route by id, the whole matched chain, or the current navigation state.
| Hook | Scope | Common use |
|---|---|---|
| useLoaderData() | Current route | Page-level data from a loader |
| useActionData() | Current route | Form submission result |
| useRouteLoaderData(id) | A specific route by id | Parent loader data in a child |
| useMatches() | Every matched route | Breadcrumbs, analytics |
| useNavigation() | Global navigation state | Pending/loading states |
react-router-dom inside files under src/app/. In .mdx and .md files you must import them explicitly.Returns the resolved value of the current route's loader. Use this inside the page component that defines the loader.
Returns the resolved value of the current route's action. It is undefined until the action has run at least once.
Returns the loader value of a route by its route id. Use this in a child component that needs the loader data from a parent layout without re-fetching it.
src/app/dashboard/layout.tsx is available under the id dashboard.Returns an array of every route in the current matched chain, each with its handle and data. Use this for breadcrumbs, analytics, or any component that needs to know the full URL hierarchy.
Fetch data before a route renders.
Handle form submissions and mutations.
Catch render errors and show a fallback UI.
Show a fallback while pages and layouts load.
Create your first pages and wrap them in shared layouts.
Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.