I am new to the react-redux application. My actions consist of a little hierarchy like this one:
{
type:'FITLER',
filterType: 'FILTER_COUNTRY',
payload: countries
}
In my reducer, among other functions, I am writing one of my reducer as:
function FilterValue(state, action){
switch(action.type){
CASE FILTER:break;
CASE FILTER_CLEAR_ALL:break;
default:
}
}
I was wondering if I should make nested switch statements for my typical case like:
function FilterValue(state, action){
switch(action.type){
CASE FILTER:
switch(action.filterType){
CASE FILTER_COUNTRY:break;
CASE FILTER_REGION: break;
default:
}
CASE FILTER_CLEAR_ALL:
default:
}
}
I looked into these articles and SO questions but none of them answered about this programming practice.
Object Literals vs Switch Case
Reduce Reducers vs Combine Reducers
EDIT: I am already using reduceReducers and Thunk middleware. My question is only regarding nested switchcase.