-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
604caff
commit a7141c8
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { INCREMENT_COUNTER, DECREMENT_COUNTER } from '../actions/CounterActions' | ||
|
||
const initialState = 0 | ||
|
||
const counter = (state = initialState, action) => { | ||
switch (action.type) { | ||
case INCREMENT_COUNTER: | ||
return state + 1 | ||
|
||
case DECREMENT_COUNTER: | ||
return state - 1 | ||
|
||
default: | ||
return state | ||
} | ||
} | ||
|
||
export default counter |
5 changes: 4 additions & 1 deletion
5
src/common/redux/reducers.js → src/common/redux/reducers/index.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { combineReducers } from 'redux' | ||
import { routerReducer } from 'react-router-redux' | ||
|
||
import counter from './counter' | ||
|
||
const rootReducer = combineReducers({ | ||
routing: routerReducer, | ||
counter, | ||
routing: routerReducer | ||
}) | ||
|
||
export default rootReducer |