How basir/react-18-shopping-cart works
This is a small React shopping-cart app: shoppers browse a fixed product catalog, add or remove quantities, and see a cart subtotal, tax, shipping, and total. App owns cart state and browser-storage persistence, while the catalog and UI components render products and cart controls. The README also mentions deferred cart loading and checkout, but checkout is only a placeholder alert. The graph follows the sampled runtime; it does not assume unsampled behavior.
Main entry points: App.js App state · Main.js Product listing · Basket.js Cart totals · index.js React entry
Components 9
Cart state
- App state
src/App.js - Browser storage
Product catalog
- Product data
src/data.js
Shopping UI
- Product listing
src/components/Main.js - Product card
src/components/Product.js - Cart totals
src/components/Basket.js - Cart header
src/components/Header.js - React entry
src/index.js
Other components
- Shopper
Connections 9
- Shopper → App state: uses
- React entry → App state: renders
src/index.js - App state → Product data: reads
src/App.js - App state → Product listing: renders
src/App.js - App state → Cart totals: renders
src/App.js - App state → Cart header: renders
src/App.js - Product listing → Product card: renders
src/components/Main.js - App state → Browser storage: reads and writes
src/App.js - Cart totals → App state: calls cart handlers
src/App.js