How to pass an array of object to a server action function ?
Unanswered
Long-horned bees posted this in #help-forum
Long-horned beesOP
I am new to server actions and don't understand this error when using server action function and useFormState !!
Code demo :
import { createCategory } from "@/app/actions/category/action";
const updatedCreateForm = createCategory.bind(null,sections);
return(
<form action={updatedCreateForm}.......></form>
// Where can I read or learn about server actions better do share if you know
Code demo :
import { createCategory } from "@/app/actions/category/action";
const updatedCreateForm = createCategory.bind(null,sections);
return(
<form action={updatedCreateForm}.......></form>
// Where can I read or learn about server actions better do share if you know
3 Replies
@Long-horned bees I am new to server actions and don't understand this error when using server action function and useFormState !!
Code demo :
import { createCategory } from "@/app/actions/category/action";
const updatedCreateForm = createCategory.bind(null,sections);
return(
<form action={updatedCreateForm}.......></form>
// Where can I read or learn about server actions better do share if you know
you can use the
.bind method to add specific data to your server actions: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#passing-additional-arguments@Long-horned bees solved?
Long-horned beesOP
@B33fb0n3 Yes, Thanks alot !!