Jul 4, 2024
use server
directive to annotate functions meant to run on the server.Detecting the Issue: Using Sentry
Displaying Loading State
useFormStatus
hook.pending
state to disable the submit button and show a loading text.Fixing the Implementation
useFormStatus
hook must be used as a child of the form element using a server action.Separate Actions Directory
Types Directory
Form Validation with Zod
Redirect After Submission