From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Form fields and slugify

Form fields and slugify

So now we're going to add the form fields to our form and another thing we're going to do is add this this slug Generate button where if we have something here like hello World and we click generate it'll create a slug for that from that name And we're going to use a third-party package called slugify, so let's just install that so npm install Slugify, and I'm just going to add my legacy Pierre Deps Flag and then we're gonna go into the product form and let's import Slugify it's a it's a default export. So slugify from Slugify All right, and then we're gonna come down to where our comments are and I'm gonna leave the comments and just go under it So here we want the name form field So let's use the shad CN form field. Make sure you bring that in and that's gonna be self-closing but we want to add a couple things onto it. So one is going to be the control, which is always going to be set equal to the form.control from React hook form. And then we have the name, which in this case is…

Contents