diff --git a/.changeset/fix-action-data.md b/.changeset/fix-action-data.md
new file mode 100644
index 0000000000..376fc7f141
--- /dev/null
+++ b/.changeset/fix-action-data.md
@@ -0,0 +1,5 @@
+---
+"react-router": patch
+---
+
+Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree
diff --git a/packages/react-router-dom/__tests__/data-browser-router-test.tsx b/packages/react-router-dom/__tests__/data-browser-router-test.tsx
index 574b653816..3c96cf2444 100644
--- a/packages/react-router-dom/__tests__/data-browser-router-test.tsx
+++ b/packages/react-router-dom/__tests__/data-browser-router-test.tsx
@@ -186,7 +186,6 @@ function testDomRouter(
"
parent data
- child action
idle
child data
@@ -238,7 +237,6 @@ function testDomRouter(
"
,
+ Component() {
+ let data = useLoaderData() as string;
+ let actionData = useActionData() as string | undefined;
+ return (
+ <>
+
Action
+
{data}
+
{actionData}
+ >
+ );
+ },
})}
/>
@@ -1054,8 +1062,6 @@ function testDomRouter(
let { container } = render();
function Home() {
- let data = useMatches().pop()?.data as string | undefined;
- let actionData = useActionData() as string | undefined;
let navigation = useNavigation();
let submit = useSubmit();
let formRef = React.useRef(null);
@@ -1067,8 +1073,6 @@ function testDomRouter(