+ 2
Can someone help me how to update total price of order after removing item from list???
Update total price after remove
6 Answers
+ 3
What is your attempt so far?
+ 1
https://www.sololearn.com/compiler-playground/WAyWdJ5s3qj4
I hope you will find it. For this purpose I set ID as empty string, because I dont know how to add another js file here. Thanks a lot.
+ 1
Thanks everyone for help... I solved it đđ
0
Reading such 2 huge walls of text is a lot. Please link your code via a codebit from the Code Playground.
0
Hi,
I think using splice in your function remove_order is causing the issue
Maybe instead of doing findIndex
Do this
Const newOrder = order. filter( searchOrder => searchOrder.id === id)
This newOrder will be an updated list without the given item having said "id"
0
Miriam BalĂĄzsovĂĄ Also, Im curious
Why are you saving list of prices in localStorage seperately
Instead of having them in orders item directly like,
Id: uuidv4(),
item : e.target.name,
number : .....,
Price : (its price)
?