From the course: Building React and Django Apps
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating a basic form as a React component
From the course: Building React and Django Apps
Creating a basic form as a React component
- [Narrator] The Checkout form needs to be implemented. It's going to use the AppContext. In the render method. these are the methods and data we're going to need from that context. We're going to be displaying four input fields. One for the users name, another for their email address, their street address and their city. Now let's render each form field by mapping the input fields and using the formField component. The field value comes from the booking model and whenever we update this form field we're going to use the updateField callback from the AppContext. And then we pass in the rest of the field properties. We're going to display the item that is about to be ordered along with a button to remove it. Here's the Remove button and when we click, we use the AppContext clearOrderItem method and we pass in the item.id. And within this button, we're also going to have a nice icon that comes from the Font Awesome…
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
-
-
-
-
-
Handling creating models with Django REST framework1m 39s
-
Creating a REST API Service class with React and Axios2m 24s
-
Creating a basic form as a React component2m 22s
-
Creating form fields for basic form2m 6s
-
Connecting a React component to a service2m 26s
-
Validating form data with Django REST framework54s
-
Displaying validation errors with React1m 23s
-
-
-
-