1. 23
    Update Server Action and Form Action To Provide Better UX for Submitting a Form in Next.js
    1m 42s

Update Server Action and Form Action To Provide Better UX for Submitting a Form in Next.js

Share this video with your friends

Send Tweet

By doing a little refactoring to both our form action and the server action function, we can make use of react hooks to clean up the user experience.

Here we will get our form data within the form action and pass that data directly to our addCustomer server action. While we are in there we'll attach a ref to the form and reset the form and close the modal.