-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learn React with TypeScript
By :

In this chapter, we learned how to build forms in React, starting with a basic HTML form with the Form
component from Next.js to prevent a full page reload during form submission.
We learned that Server Actions are special Server Functions used for form submissions using a form
element’s action
attribute. The nice thing about this submission pattern is that it works without JavaScript.
We covered how to use the useFormStatus
Hook for a submission indicator and disabling form
elements, and understood its requirement for being in a child component of a form
element. We learned that the useActionState
Hook is an alternative way of implementing a submission indicator and disabling form
elements when the form is in the same component. The useActionState
Hook also allows the rendering of server-side validation errors.
We introduced ourselves to a popular forms library called React Hook Form to provide client-side validation with a Zod schema. This contains a useForm...