Help with typescript error on server action. (i am completely new to this)
Unanswered
Silver cyprinid posted this in #help-forum
Silver cyprinidOP
i've attached a screenshot showing the code and the error.
i am trying to invoke a server action from a button which takes in an array of id's (strings) and deletes those lines from the DB.
i can;t figure out the typescript error. should i be doing this a different way? any help would be much appreciated!
thanks
i am trying to invoke a server action from a button which takes in an array of id's (strings) and deletes those lines from the DB.
i can;t figure out the typescript error. should i be doing this a different way? any help would be much appreciated!
thanks
6 Replies
An arrow function
And inside it call it with an await
Because a server action is async, so you can't just put that inside the form action field and expect it to work
@Arinji Because a server action is async, so you can't just put that inside the form action field and expect it to work
Silver cyprinidOP
thanks for you response. could i be a pain and ask you to show me how the action should look? i've tried to replicate using your advise, but i'm clearly not doing it right. thanks
Something in the sense of this
action={async () => {
await function()
}}
action={async () => {
await function()
}}