I'm trying to learn react redux and I'm trying to create a simple example using a shopping list with get, delete and add items.
I have an example here that shows it working with get and delete items.
My problem is in the reducer with the add item.
Here is the same example but with the additem in reducer.
case ADD_ITEM:
return{
...state,
items: [...state.items, {id: uuid(), action.payload}]
}
It's complaining about action.payload
The error I get locally is
./src/reducers/itemReducer.js
Line 26: Parsing error: Unexpected token, expected ","
24 | return{
25 | ...state,
> 26 | items: [...state.items, {id: uuid(), action.payload}]
| ^
27 | }
28 | default:
29 | return state
Can anyone see what I'm doing wrong.