Skip to content

Commit

Permalink
Update basket.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPD93 authored Oct 27, 2022
1 parent 5617236 commit d470cfc
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions pages/basket.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ const Basket = () => {

useEffect(() => {
setCurrentBasket(JSON.parse(localStorage.getItem("basket")));
console.log(currentBasket);

let basketArray = JSON.parse(localStorage.getItem("basket"));
let total = basketArray.reduce((acc, current) => {
return current.price * current.quantity + acc;
}, 0);
console.log(total);
setTotalCost(total);
}, []);

Expand Down

0 comments on commit d470cfc

Please sign in to comment.