Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 1.21 KB

File metadata and controls

25 lines (16 loc) · 1.21 KB

Exercise 4

Goal

Implement Add to Cart Functionality.

Requirements

  1. On click of addToCart item should be added to the cart. Store cart details in Recoil State. Addcart button

  2. Add and Remove items from cart ( - and + ). If the item is present in cart then instead of Add to Cart button show the following. Goal In the above image, the number between plus and minus buttons is the current quantity in the cart.

  3. On click of cart button, show the items in the card as follows: cart Price is calculated by price per item * quantity in the cart. The above cart dropdown is shown only if cart button from header is clicked.

Hints:

  1. Use Recoil for managing React State
  2. In the cart dropdown the quantity should be equal to the quantity added to the cart.