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 - Next.js Tutorial
From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Section intro1m 11s
-
(Locked)
Get products for admin page8m 24s
-
(Locked)
Display products7m 55s
-
(Locked)
Delete products4m 16s
-
(Locked)
Create and update actions8m 30s
-
(Locked)
Create product page and form9m 35s
-
(Locked)
Form fields and slugify13m 27s
-
(Locked)
Create product form submission6m 23s
-
(Locked)
Uploadthing configuration8m 9s
-
(Locked)
Add image upload12m 56s
-
(Locked)
Product cleanup7m 57s
-
(Locked)
Is featured banner8m 55s
-
(Locked)
Product update form9m 57s
-
(Locked)
-
-
-
-
-
-