Skip to content

Add cart functionality#2

Draft
mmena1 wants to merge 2 commits into
mainfrom
add-cart-functionality
Draft

Add cart functionality#2
mmena1 wants to merge 2 commits into
mainfrom
add-cart-functionality

Conversation

@mmena1
Copy link
Copy Markdown
Owner

@mmena1 mmena1 commented Aug 1, 2023

No description provided.

Comment thread src/components/Cart/Cart.tsx Outdated
Comment on lines +22 to +26
{cartCtx.items.map(item => {
<ListItem disablePadding>
<ListItemText primary={item.name} />
</ListItem>
})}
Copy link
Copy Markdown
Owner Author

@mmena1 mmena1 Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, this doesn't work. But if I do cartCtx.items[0].name the name gets displayed. Why doesn't it work with map?

Comment on lines +27 to +32
{/* <ListItem disablePadding>
<ListItemText primary="Hello" />
</ListItem>
<ListItem disablePadding>
<ListItemText primary="World" />
</ListItem> */}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, on the other hand, works as expected, so I'm not sure what's wrong with cartCtx.items.map

@mmena1 mmena1 marked this pull request as draft August 1, 2023 14:34
Comment on lines +39 to +40
{cartItems}
{/* {cartCtx.items[0].name} */}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I comment the first line and uncomment the second one, {cartCtx.items[0].name} works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant