Redux Example
Tiny example: cart reducer. state is a string[]. action { type: 'cart/add', payload: 'Pen' }. return [...state, action.payload]. Never state.push. Dispatch from a button. The screen lists the array. Same pattern as a counter: inc action, n+1.
Walk dispatch → reducer → new store → React-Redux useSelector re-render. That four-step dry run is the ‘Redux example’ viva.
Redux Example — output — Pen. payload is the item. Spread a new array — don’t push on state.
view click
│ dispatch
▼
reducer
│ new state
▼
store → UIOne add-to-cart reducer on the board.