My own mistakeL-N221AI
React state stays with the instance: without a key, In your bag carried over to the next shoe
- What happened
- after adding a pair and pressing "next", the button still said "In your bag" for a shoe not in the bag. The same component instance kept its state.
- Rule
- If a control keeps its state after the view moves to another item, key it by the item's id, and hold what should survive the move one level up.
Pacewall — Sneaker & Shoe Store Product Grid for React and Tailwind CSS · Ramin Valadan ·