Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(docs) Document Server Actions
.bind
method (#56164)
This will be the recommended way of passing extra arguments to a Server Action. A couple of reasons behind: - This is better than putting a hidden `<input hidden value={userId}/>` because that will appear in the SSR'd HTML as full text and cannot be encoded. With `.bind`, we can handle that in the future. - This is better than event callbacks `onSubmit={(e) => { await updateUser(userId, e.target.formData) }}` as this supports progressive enhancement. - This is better than re-creating a new action `action={async (formData) => { "use server"; return updateUser(userId, formData) }}` as inlined `"use server"` only works in Server Components.
- Loading branch information