Angular - State Management
Given this reducer:
What will be the state after dispatching
const initialState = { value: 10 };
function valueReducer(state = initialState, action) {
switch(action.type) {
case 'add':
return { value: state.value + action.payload };
case 'subtract':
return { value: state.value - action.payload };
default:
return state;
}
}What will be the state after dispatching
{ type: 'add', payload: 5 }?