Skip to content

Commit

Permalink
feat(redux): add counter reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
kiki-le-singe committed Jan 8, 2017
1 parent 604caff commit a7141c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/common/redux/reducers/counter.js
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
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

0 comments on commit a7141c8

Please sign in to comment.