You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,9 +282,27 @@ npm run build
282
282
283
283
## Performance Notes
284
284
285
-
- Minimal client state; cart via `react-use-cart`; product data is static for the demo.
286
-
- Centralized currency formatting.
287
-
- Lazy‑loaded images in catalog views.
285
+
A quick look at choices in this codebase that keep it fast and lean in production:
286
+
287
+
-**Simple state model:** No heavy global store (Redux/MobX). Cart is handled by a small, focused provider (`react-use-cart`), keeping re‑renders localized to consumers.
288
+
-**Cart persistence that doesn’t thrash:** Cart data is stored in `localStorage` and updated only on cart actions; guest→user merge runs once at login and de‑duplicates by product id.
289
+
-**Auth activated only when needed:** The Auth0 provider is *rendered* only in `auth0` mode; in `local`/`api` modes the app runs without that runtime overhead.
290
+
-**Route-centric architecture:** Pages are split into self‑contained components, making it straightforward to adopt route‑level code splitting (`React.lazy`) without restructuring.
291
+
-**Production CRA build:**`react-scripts build` outputs content‑hashed, minified bundles with vendor/app chunking via Webpack’s SplitChunks, enabling long‑term HTTP caching.
292
+
-**Tailwind kept tight:** In production, unused utility classes are purged, yielding a compact CSS file. The forms/typography plugins add styles only when their classes are used.
293
+
-**Tiny icon payloads:** Icons are imported individually (e.g., a single `HiOutlineShoppingCart`), allowing tree‑shaking to avoid shipping entire icon packs.
294
+
-**No runtime i18n framework:** Currency and locale formatting rely on the native `Intl.NumberFormat`, avoiding extra dependencies and keeping number formatting fast.
295
+
-**Static demo data:** The catalog uses static data for the demo, so the app avoids client‑side waterfalls and remains interactive immediately after load.
296
+
-**Clean separation of concerns:**`lib/config`, `lib/auth`, and `lib/format` keep logic isolated, reducing prop‑drilling and keeping components shallow for faster renders.
297
+
-**Scroll behavior tuned for UX:** A lightweight `ScrollToTop` resets scroll on navigation without adding heavy scroll management libraries.
298
+
-**Accessible-by-default UI:** Semantic markup and form validation reduce layout thrash and improve focus handling without extra JS.
299
+
-**Hosting‑friendly SPA:** The output is a static bundle that can be served from any CDN/host with gzip/brotli and cache‑headers for excellent TTFB and repeat‑visit speeds.
300
+
301
+
### Ready when you need more
302
+
If the catalog or pages grow substantially, the structure already supports:
303
+
-**Route‑level code splitting** with `React.lazy` and `<Suspense>`.
304
+
-**List virtualization** for very long product lists (React Window/Virtual).
305
+
-**Image optimization** (AVIF/WebP, responsive `srcset`) on real assets.
0 commit comments