Skip to content

Commit deea9b8

Browse files
authored
Update server-functions.md
Fix: Add missing onChange to input in server-functions.md examples
1 parent 27d86ff commit deea9b8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/content/reference/rsc/server-functions.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,23 @@ You can pass a Server Function to a Form to automatically submit the form to the
157157
```js [[1, 3, "updateName"], [1, 7, "updateName"]]
158158
"use client";
159159

160-
import {updateName} from './actions';
160+
import { useState } from "react";
161+
import { updateName } from "./actions";
161162

162163
function UpdateName() {
164+
const [name, setName] = useState("");
165+
163166
return (
164167
<form action={updateName}>
165-
<input type="text" name="name" />
168+
<input
169+
type="text"
170+
name="name"
171+
value={name}
172+
onChange={(e) => setName(e.target.value)}
173+
/>
174+
<button type="submit">Update</button>
166175
</form>
167-
)
176+
);
168177
}
169178
```
170179

0 commit comments

Comments
 (0)