Created
June 30, 2020 11:19
-
-
Save alexmochu/352fef66284888ddd0f688391e790eb1 to your computer and use it in GitHub Desktop.
Create Reducer
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
import { combineReducers } from 'redux'; | |
const initialState = 0; | |
function count(state = initialState, action) { | |
switch (action.type) { | |
case 'INCREMENT': | |
return state + 1 | |
case 'DECREMENT': | |
return state - 1 | |
default: | |
return state; | |
} | |
} | |
const rootReducer = combineReducers({ | |
count | |
}); | |
export default rootReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment