From 1f748fd3c79fafbabaa383aba14d4ab122817c5b Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 12 Sep 2026 02:22:11 +0300 Subject: [PATCH] Fix Server Function signature and two typos in 'use server' reference requestUsername is passed to useActionState but declared as requestUsername(formData). useActionState calls the action with the previous state as the first argument, so formData ends up null and formData.get('username') throws. The useActionState reference already covers this under "My Action cannot read form data". Also drop a stray semicolon in the LikeButton example, where it sits in the fragment's children and renders as text, and remove a duplicated word in the RSC banner so it matches use-client.md. --- src/content/reference/rsc/use-server.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/reference/rsc/use-server.md b/src/content/reference/rsc/use-server.md index 27ef9ee3cca..148f5130bcd 100644 --- a/src/content/reference/rsc/use-server.md +++ b/src/content/reference/rsc/use-server.md @@ -5,7 +5,7 @@ titleForTitleTag: "'use server' directive" -`'use server'` is for use with [using React Server Components](/reference/rsc/server-components). +`'use server'` is for use with [React Server Components](/reference/rsc/server-components). @@ -139,7 +139,7 @@ To update the UI based on the result of a Server Function while supporting progr // requestUsername.js 'use server'; -export default async function requestUsername(formData) { +export default async function requestUsername(prevState, formData) { const username = formData.get('username'); if (canRequest(username)) { // ... @@ -199,7 +199,7 @@ function LikeButton() { return ( <>

Total Likes: {likeCount}

- ; + ); }