Intro to Forms with Next.js App Router
In this tutorial you'll learn how to do forms the right way with the Next.js App Router.
You'll learn a fast and easy way to do both client and server-side field validations, as well as four distinct methods of sending form data to the server.
You will have access to all the code, allowing you to figure out which method suits your project the best.
Tools and Libraries
For the UI elements, this project will use shadcn layered on top of Tailwind. Feel free to use any UI libraries you prefer, but bear in mind that you'll need to modify the code accordingly.
React Hook Form will be used to manage our form, data, and client-side validations.
We'll also use Zod, a schema validation library, to verify data on both the client and server sides.
The Importance of Validation
It's not uncommon to come across projects where data is only validated on the client side. However, relying solely on client-side validation is a major flaw. You should never fully trust the client.
The importance of data validation on both the client and server sides cannot be stressed enough. You'll learn how to validate data in both places using the same validation, making it super easy.
Getting Started
In this tutorial you'll be provided with commands and code to run, as well as opportunities to try things out for yourself.
In the next video, we'll start by creating our Next.js application with App Router and Tailwind CSS as well as initializing the shadcn UI library.