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

Partially updating an item using React

From the course: Building React and Django Apps

Start my 1-month free trial

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…

Contents