// the find
jeffersonRibeiro/react-shopping-cart
🛍️ Simple ecommerce cart application built with Typescript and React
A small reference app showing how to build a shopping cart UI with React, TypeScript, Context API, and styled-components — no real backend, just a static products.json and a Firebase-hosted demo. It's for someone who wants a clean example of Context-based state management for cart/filter logic, not for anyone trying to ship actual ecommerce.
Every component has a colocated test file and snapshot, and the cart logic itself (useCart, useCartProducts, useCartTotal) is unit-tested in isolation from the UI — a genuinely good pattern to copy. Splitting cart state and products state into separate Context providers instead of one giant store keeps re-renders scoped sensibly. TypeScript types for Product/CartProduct in src/models give you a clear data contract to steal.
There's no persistence — refresh the page and the cart is gone, since it's all in-memory Context with no localStorage or backend sync, so it doesn't actually demonstrate the hard part of a cart (surviving navigation, multiple tabs, server reconciliation). The 'ecommerce' framing is misleading: there's no checkout, no pricing logic beyond formatPrice, no payment integration, and products come from a static JSON file, not an API. The codebase also ships a personal recruiter ad component (src/components/Recruiter) bundled into the production app, which is a weird thing to find in code you're about to pattern-match against.