#Asking for edit/update data example

1 messages · Page 1 of 1 (latest)

tight voidBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

calm rain
#

Try Server Actions

You can directly pass the function to an “action” prop in the form: <form action = {yourAction}>

This will handle the form data directly to your server action.

You could also call them inside your typical onSubmit/onClick handlers like a regular function, with the difference this will run exclusively on the server.

calm rain
#

You work with the input itself not react state, you can use a hook to handle return values from submitting the action, in case you want to get errors back or whatever.

const [state, formAction, isPending] = useActionState(yourActionFn, initialState);
// initial state fills the "state" variable for the initial render