From the course: React.js: Building an Interface

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Adding a new appointment

Adding a new appointment - React.js Tutorial

From the course: React.js: Building an Interface

Start my 1-month free trial

Adding a new appointment

- [Instructor] We're almost done with this project. Now we have to figure out how to pass along the information when somebody types in a new appointment. To take care of that, we're going to go to AddAppointment and we're going to need to create a variable that's going to hold the information for the form. So in addition to toggleForm, we'll create a variable here and it'll be formData. Of course, we'll need setFormData as well. We'll useState and the default here is going to be essentially an object with all of the different form fields. So I'll need the ownerName and all the other ones. Now, I know I'm going to need this object whenever I need to clear out the form. So I'm actually going to put this in a separate variable. And then I'll use that to initialize the form and I'll use it later to clear the form whenever somebody finishes typing something in. All right, so now we need to go ahead and do the events for…

Contents