答案 0 :(得分:1)
const userReducer = (state=initialState, actions) => {
switch(actions.type) {
case UPDATE_USERS:
return {...state, users: [...actions.payload.users]}
default:
return {...state}
}
}
在react reducer中,对于数组使用 [...Array],对于对象使用{...object}