TREKBAG
A modern React & Vite app to manage your packing list—built with advanced React patterns and optimized with Zustand for global state and persistence.
Demo
🔗 TREKBAG
Features
-
Add & Remove Items
Add new items via a controlled form and delete or toggle them individually. -
Checkbox List
Manage “packed” state withuseState
and map over your items array. -
Sorting UI
Use react-select to sort by status. -
LocalStorage Persistence
Automatically persist your list between sessions using Zustand’s built-in persist middleware. -
Separation of Concerns
Component logic lives in custom hooks or the store, while presentation stays in dumb UI components. -
Memoization & Performance
Derive filtered and sorted lists withuseMemo
; avoid unnecessary re-renders with zustand selectors. -
Children Composition
Flexible layout viachildren
props, evolving from prop-drilling to context and finally to Zustand.⚠️ Styling & Responsiveness
Styling was not a priority for this project, so the UI isn’t fully responsive.
Evolution
- Prop Drilling
All state and update handlers lived inApp.jsx
and were passed down through multiple layers. Functional components with props &children
composition were used originally - Context API + Custom Hook
Introduced anItemsContextProvider
anduseItemsContext
to avoid prop-drilling, with manual localStorage sync. - Zustand Store
Replaced Context entirely with a lightweight Zustand store (itemsStore.js
) using itspersist
middleware to handle localStorage automatically.The old
contexts/
folder andlib/hooks.js
remain in the repo for reference only.
Tech Stack
- App Framework: Vite + React
- State Management:
Zustand (with
persist
) - UI: Functional components with props &
children
composition - Sorting: react-select
- Deployment: Vercel