From the course: Next.js 14 from Scratch: Build a Real-World Project Using Next.js 14 and MongoDB

Unlock this course with a free trial

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

Form input handlers

Form input handlers

All right, guys. So now we need to add the handler functionality. Because right now, I can't select anything different for the type. I can't type anything in. So we want to add the functionality to these three handlers. Now, one thing I did in the last video is I made a mistake by putting I had property type. I'm not going to go back. But for the ID and name and the label for, I had property underscore type. You want to make sure that that's just type, because the name needs to match whatever is in the state. So type and type, because we're going to be using that name in our handler. So just make sure that you have type and not property type. All right, and I'll change it in the theme as well. So in the handle change here, let's pass in our event object. And if we log, let's say, e.target.name, and I just type anything in its description, you'll see that I get the name description. So I want that, and I also want the value, so e.target value. So if I type something in here, you can…

Contents