Conversation
liserezvee
commented
Jul 15, 2021
- added favorite button for the favorite cart
| onClick={(e) => { | ||
| e.preventDefault(); | ||
| onAddToCartClick(product); | ||
| onAddToCartClick(product); |
There was a problem hiding this comment.
this is a bit weird 1 space extra indentation.
There was a problem hiding this comment.
Sorry i didn't notice those error..
| setClick(!click); | ||
| }} | ||
| > | ||
| {!!click ? "Remove Favorite❌" : "Add favorite 👍🏼"} |
| cartItems: `name, price, description, image, count`, | ||
| }); | ||
|
|
||
| db.version(2).stores({ |
There was a problem hiding this comment.
why create a different db for this, you could just add favoriteItems store in the previous definition along with cartItems, right?
There was a problem hiding this comment.
I thought i need another db for this favorite item list . So i used this one.
| @@ -0,0 +1,60 @@ | |||
| import { useState, useEffect } from "react"; | |||
There was a problem hiding this comment.
not bad but this is pretty much a copy of everything I wrote which is why you have a bunch of code that doesn't quite apply to favorite list. can you identify those lines?
There was a problem hiding this comment.
Actually i didn't understand how to implement those things so copied your cart item theme and tried to work on this . And i removed lots of cart item codes but as you said there are still available i'll check those codes and try to solve ..
Thanks