import React from 'react' import {Droppable} from "@hello-pangea/dnd"; import {cartStyle, compareArraysWithIds} from "./utils"; import {ProductCartItemHorizontal} from "./ProductCartItemHorizontal"; import {HORIZONTAL_CART_MARKER, useShopStore} from "./shop_store"; // #!render_count import {useRenderCount} from "@uidotdev/usehooks"; /** * Component that displays a list of */ export function CartHorizontal({crate_index}) { // #!render_count const renderCount = useRenderCount(); const crate = useShopStore((state) => state.crates[crate_index], (a, b) => { return compareArraysWithIds(a.h_items, b.h_items) }); // #!render_count console.log("CartHorizontal renders: ", renderCount) const products = crate.h_items.map((item, index) => { return ( ); }); return ( {(provided, snapshot) => (
{products} {provided.placeholder && (
{provided.placeholder}
)}
)}
); }