# om

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

ag 23:07:41

anyone using with datascript? aside obvious benefits, what pitfalls should be avoided?

whistlerbrk 23:23:13

Having a simple problem I can’t seem to solve. Building a demo app of a shopping carts. Products and a cart. When you click “add to cart” from a product in the listing the item appears in a cart. I have all this working except when I push an item into cart_items I’m not sure how I’m suppose to do this — I need to keep track of count since you can say purchase more than one of same product. So my initial idea was: {:products [{id: 1 name: “Foo”}] :cart {1: {count: 3 product: [:product/by-id 1]}}}

whistlerbrk 23:25:35

so I’ve made my :cart db-style (a map whose keys are the product ids) so I can easily update the count. Is this bad? Should I consider a different way, most importantly, I need to get that product info when I’m rendering a CartItem and I don’t know how to do it