From the course: Building React and Django Apps
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Partially updating an item using React
From the course: Building React and Django Apps
Partially updating an item using React
- [Instructor] When a tour package is added to a user's wishlist we also want to know if they have tried to reserve that tour as well. When they click reserve on a tour the order item is set with the setOrderItem method in the App. And we are going to be calling a service API method to update the wishlist cart status. We pass in the item ID and true to indicate that this wishlist item has been added to the cart. And then we do the same thing as before. We update the state and we resolve with the item. Now we have to do something similar in case the user removes that tour package but leaves it on their wishlist. This time we're sending in false because it's been removed from the cart. And the rest of the code here is the same. Now we open up ServiceApi and update that method. We're going to reuse the config and the data we are going to be sending with our HTTP PATCH request is the id and added_to_cart. Then we…
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
-
-
-
-
Creating a ViewSet with Django1m 2s
-
(Locked)
Displaying a list of items with React2m 47s
-
Deleting an item using React and Django1m 49s
-
(Locked)
Partially updating an item using React1m 50s
-
(Locked)
Pagination with Django38s
-
(Locked)
Pagination with React3m 31s
-
(Locked)
Filtering with Django1m 56s
-
(Locked)
Filtering with React4m 44s
-
-
-
-
-