extra args on server action
Unanswered
Southeastern blueberry bee posted this in #help-forum
Southeastern blueberry beeOP
hello anyone know how i can pass extra argument to a server action using useActionState; docs explain it when using server action but not with useActionState case,
since i pass a complex data structure i cant use an hidden input :/
since i pass a complex data structure i cant use an hidden input :/
'use client'
import { updateUser } from './actions'
export function UserProfile({ userId }: { userId: string }) {
const updateUserWithId = updateUser.bind(null, userId)
return (
<form action={updateUserWithId}>
<input type="text" name="name" />
<button type="submit">Update User Name</button>
</form>
)
}