import { USER_LOG } from '../actions/actionTypes';
const initialState = {
data: {
name: 'Name',
rating: ["10", "9.1"]
},
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case USER_LOG:
return {
data: {
name: action.payload.name,
rating: [...state.rating, action.payload.rating]
},
};
default: return state;
}
};
export default reducer;
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"]
},
};