coryhouse / coryhouse/react-restaurant-scriptpro

Refactor cart to useReducer

Open
#25 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
Refactor the cart's ad-hoc setters into a single `useReducer` with `ADD_ITEM`, `REMOVE_ITEM`, `UPDATE_QUANTITY`, and `CLEAR` actions. The point: when state transitions are coordinated, reducers beat multiple `useState` calls.

## Acceptance criteria
- [ ] Cart state managed by `useReducer`
- [ ] Action types fully typed (discriminated union)
- [ ] All existing cart behavior unchanged
- [ ] Playwright cart test still passes

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.