Created
August 27, 2015 17:47
-
-
Save mizchi/ad20d815431df89f463f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rootReducer = combineReducers({ | |
counter: (state = 0, action) => { | |
switch (action.type) { | |
case INCREMENT_COUNTER_IF_ODD: | |
if (state % 2 === 1) { | |
return state + 1; | |
} else { | |
return state; | |
} | |
case INCREMENT_COUNTER: | |
return state + 1; | |
case DECREMENT_COUNTER: | |
return state - 1; | |
default: | |
return state; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment