const reducer = (state = initialState, action) => {
switch (action.type) {
case USER_LOG:
return Object.assign({}, state, {
name: action.payload.name,
rating: [...state.data.rating, action.payload.rating]
})
default: return state;
}
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case USER_LOG:
return {
...state,
name: action.payload.name,
rating: [...state.data.rating, action.payload.rating]
}
default: return state;
}
};
const initialState = {
data: {
name: 'Name',
rating: ["10", "9.1"]
},
};