Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/content/reference/rsc/server-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ Client Components can import Server Functions from files that use the `"use serv
export async function createNote() {
await db.notes.create();
}

```

When the bundler builds the `EmptyNote` Client Component, it will create a reference to the `createNote` function in the bundle. When the `button` is clicked, React will send a request to the server to execute the `createNote` function using the reference provided:
Expand Down Expand Up @@ -131,9 +130,10 @@ function UpdateName() {
} else {
setName('');
}

})
}

return (
<form action={submitAction}>
<input type="text" name="name" disabled={isPending}/>
Expand All @@ -153,7 +153,6 @@ Server Functions work with the new Form features in React 19.

You can pass a Server Function to a Form to automatically submit the form to the server:


```js [[1, 3, "updateName"], [1, 7, "updateName"]]
"use client";

Expand Down Expand Up @@ -195,7 +194,7 @@ function UpdateName() {

When using `useActionState` with Server Functions, React will also automatically replay form submissions entered before hydration finishes. This means users can interact with your app even before the app has hydrated.

For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
For more, see the docs for [`useActionState`](/reference/react/useActionState).

### Progressive enhancement with `useActionState` {/*progressive-enhancement-with-useactionstate*/}

Expand All @@ -219,4 +218,4 @@ function UpdateName() {

When the <CodeStep step={2}>permalink</CodeStep> is provided to `useActionState`, React will redirect to the provided URL if the form is submitted before the JavaScript bundle loads.

For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
For more, see the docs for [`useActionState`](/reference/react/useActionState).