coryhouse / coryhouse/react-restaurant-scriptpro

Create CartContext + useCart using useState

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
enhancement phase-5-cart
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Goal
Add a `CartContext` provider exposing `items`, `addItem`, `removeItem`, `updateQuantity`, `clear`, `totalItems`, `totalPrice` via `useState`. Persist items with `useLocalStorage`.

## Acceptance criteria
- [ ] `CartProvider` wraps the app inside the root route
- [ ] `useCart` hook returns the cart API
- [ ] Cart state persists across reloads via `useLocalStorage`
- [ ] All cart actions are pure functions of prior state

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.