I want to add a counter symbol or antoher sort of symbol that shows that I have items in my shoppingcart. I have use the shoppingCartIcon from mui icons library. My prject is made in react.
the code for my icon looks like this : `
<ShoppingCartIcon fontSize="large"></ShoppingCartIcon>`
`I have a function to add items to my shopping cart here :
const addToCart = (itemId) => {
if (!cartItems[itemId]) {
setCartItems((prev) => ({ ...prev, [itemId]: 1 }));
} else {
setCartItems((prev) => ({ ...prev, [itemId]: prev[itemId] + 1 }));
}
};
`
Does it works with this symbol or should i replace it with a image of a shoppingcart instead ?
I have tried to add some sorts of symbol but it dosen´t shown up.
I am really stuck here.
Lambada is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.