You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polish Server Functions examples: consistent headings, reset wording, transition comment
- Convert the remaining two Usage headings to gerund form to match the
rest of the page and react.dev convention (anchors unchanged)
- Reset wording: "succeeds" + "the form's uncontrolled fields" (aligns with #8512)
- Comment the startTransition-after-await; bump CodeStep line accordingly
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
// State updates after an await aren't automatically Transitions, so wrap them
128
129
startTransition(() => {
129
130
setError(error);
130
131
if (!error) {
@@ -185,11 +186,11 @@ function UpdateName() {
185
186
}
186
187
```
187
188
188
-
When the Form Action completes, React will automatically reset the uncontrolled fields in the form. Server Function forms can be submitted before the JavaScript bundle loads. You can add `useActionState` to access the pending state and last response.
189
+
When the Form Action succeeds, React will automatically reset the form's uncontrolled fields. Server Function forms can be submitted before the JavaScript bundle loads. You can add `useActionState` to access the pending state and last response.
189
190
190
191
For more, see the docs for [Server Functions in Forms](/reference/rsc/use-server#server-functions-in-forms).
191
192
192
-
### Server Functions with `useActionState` {/*server-functions-with-use-action-state*/}
193
+
### Calling a Server Function with `useActionState` {/*server-functions-with-use-action-state*/}
193
194
194
195
You can call Server Functions with `useActionState` for the common case where you just need access to the action pending state and last returned response. The Server Function receives the previous state as its first argument and the submitted `FormData` as its second argument. Its return value becomes the next state:
195
196
@@ -228,7 +229,7 @@ When using `useActionState` with a Server Function, the form can be submitted be
228
229
229
230
For more, see the docs for [`useActionState`](/reference/react/useActionState).
230
231
231
-
### Progressive enhancement with `useActionState` {/*progressive-enhancement-with-useactionstate*/}
232
+
### Supporting progressive enhancement with `useActionState` {/*progressive-enhancement-with-useactionstate*/}
232
233
233
234
Server Functions also support progressive enhancement with the third argument of `useActionState`.
0 commit comments