export const BuyReducer = (state = defaultState, action) => {
return{...state,
state[action.name]: action:payload //неверно
}
}
const defaultState = {
Dima: 30
}
const action = {name: 'Dima', payload: 30};
const state = {
...state,
[action.name]: action.payload
};