first commit

This commit is contained in:
2018-11-29 17:35:49 +08:00
commit 379d337dde
23 changed files with 777 additions and 0 deletions

22
src/reducers/counter.js Normal file
View File

@@ -0,0 +1,22 @@
import { ADD, MINUS } from '../constants/counter'
const INITIAL_STATE = {
num: 0
}
export default function counter (state = INITIAL_STATE, action) {
switch (action.type) {
case ADD:
return {
...state,
num: state.num + 1
}
case MINUS:
return {
...state,
num: state.num - 1
}
default:
return state
}
}

6
src/reducers/index.js Normal file
View File

@@ -0,0 +1,6 @@
import { combineReducers } from 'redux'
import counter from './counter'
export default combineReducers({
counter
})