From 094602601e7110f87907aeba616fd7ba9a7903f4 Mon Sep 17 00:00:00 2001 From: Felix <146006641+Felix-ming@users.noreply.github.com> Date: Tue, 6 Oct 2026 15:16:43 +0800 Subject: [PATCH 1/6] docs: explain useFormStatus with custom form actions Closes #8682. Document when `useFormStatus().pending` is set for a `preventDefault()` submit handler that starts a Transition in the same event, and add a runnable example for a custom form action. The example also notes that this pattern does not reset the form automatically. Validation: `yarn check-all` and `git diff --check` pass locally. The initial draft was prepared with AI assistance and reviewed against the React DOM tests and issue details. --- .../react-dom/hooks/useFormStatus.md | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/content/reference/react-dom/hooks/useFormStatus.md b/src/content/reference/react-dom/hooks/useFormStatus.md index 7517d8ae22f..2ecb69aa780 100644 --- a/src/content/reference/react-dom/hooks/useFormStatus.md +++ b/src/content/reference/react-dom/hooks/useFormStatus.md @@ -54,7 +54,7 @@ In the above example, `Submit` uses this information to disable ` + ); +} + +function Form({ submitAction }) { + function handleSubmit(event) { + event.preventDefault(); + const formData = new FormData(event.currentTarget); + startTransition(async () => { + await submitAction(formData); + }); + } + + return ( + + + + + ); +} + +export default function App() { + async function submitAction(formData) { + await submitForm(formData); + } + + return
; +} +``` + +```js src/submitForm.js hidden +export async function submitForm(formData) { + await new Promise((resolve) => setTimeout(resolve, 1000)); +} +``` + + + +Unlike a function passed to the `` prop, handling submission this way does not automatically reset the form. + + ##### `useFormStatus` will not return status information for a `` rendered in the same component. {/*useformstatus-will-not-return-status-information-for-a-form-rendered-in-the-same-component*/} From d8ff8ddc13592c0b355da877d413b4fbb2765f64 Mon Sep 17 00:00:00 2001 From: Aurora Scharff Date: Wed, 4 Nov 2026 19:27:22 -0600 Subject: [PATCH 2/6] Polish useFormStatus onSubmit documentation --- .../reference/react-dom/hooks/useFormStatus.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/content/reference/react-dom/hooks/useFormStatus.md b/src/content/reference/react-dom/hooks/useFormStatus.md index 2ecb69aa780..99fad23b7bd 100644 --- a/src/content/reference/react-dom/hooks/useFormStatus.md +++ b/src/content/reference/react-dom/hooks/useFormStatus.md @@ -112,9 +112,11 @@ export async function submitForm(query) { ``` -### Display a pending state with a custom form action {/*display-a-pending-state-with-a-custom-form-action*/} +--- + +### Display a pending state with an `onSubmit` handler {/*display-a-pending-state-with-an-onsubmit-handler*/} -If you need to handle form submission in an `onSubmit` event handler instead of passing a function to the `` prop, call `event.preventDefault()` and start a Transition in the same event handler. A component inside the form can then use `useFormStatus` to read the pending state while the action is running. +If you need to handle form submission in an `onSubmit` event handler instead of passing a function to the `` prop, call `event.preventDefault()` and start a Transition in the same event handler. A component inside the form can then use `useFormStatus` to read the pending state while the Action is running. @@ -126,16 +128,16 @@ import { submitForm } from './submitForm.js'; function SubmitButton() { const { pending } = useFormStatus(); return ( - ); } function Form({ submitAction }) { - function handleSubmit(event) { - event.preventDefault(); - const formData = new FormData(event.currentTarget); + function handleSubmit(e) { + e.preventDefault(); + const formData = new FormData(e.currentTarget); startTransition(async () => { await submitAction(formData); }); @@ -143,7 +145,7 @@ function Form({ submitAction }) { return ( - + ); From 6907d6cd65038ecd6ff5be57ce7986d08723adf7 Mon Sep 17 00:00:00 2001 From: Aurora Scharff Date: Wed, 4 Nov 2026 19:29:56 -0600 Subject: [PATCH 3/6] Clarify pending status and link form reset guidance --- src/content/reference/react-dom/hooks/useFormStatus.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/reference/react-dom/hooks/useFormStatus.md b/src/content/reference/react-dom/hooks/useFormStatus.md index 99fad23b7bd..272078ead7d 100644 --- a/src/content/reference/react-dom/hooks/useFormStatus.md +++ b/src/content/reference/react-dom/hooks/useFormStatus.md @@ -54,7 +54,7 @@ In the above example, `Submit` uses this information to disable `