Here is my reducer
const initialState = {
pros: [''],
}
export const rootReducer = (state = initialState, action) => {
switch (action.type) {
case ACTION_ADD_PROS:
return {
...state.pros,
pros: [...state.pros, action.payload]
}
case ACTION_CHANGE_PROS:
return update(state, {
pros: {
[action.index]: {
$set: action.payload
}}
});
case ACTION_REMOVE_PROS:
???
return x
default:
}
return state;
};
Can some one help me how can I remove current item from array? I have tried many ways but I don't understand what the problem here, also I have used react-addons-update for update store
id? or just the last or first one?