+ 系统设置
+
+
+ {counter}
+
+
+
+
+ )
}
}
diff --git a/src/reducers/count.js b/src/reducers/count.js
new file mode 100644
index 0000000000000000000000000000000000000000..41bda0c22a429a4cefbf634e57da2ac760e3ce7f
--- /dev/null
+++ b/src/reducers/count.js
@@ -0,0 +1,21 @@
+import * as actionType from '../action/actionType'
+const initState = {
+ counter: 10
+}
+//reducer 必须是一个方法 有两个参数 第一个是state 第二个参数是action
+export default (state = initState, action) => {
+ switch (action.type) {
+ case actionType.ADD:
+ return {
+ ...state,
+ counter: state.counter + 1
+ }
+ case actionType.JIAN:
+ return {
+ ...state,
+ counter: state.counter - 1
+ }
+ default:
+ return state
+ }
+}
diff --git a/src/reducers/index.js b/src/reducers/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5aa68043a9de002ada8f1711150b3f87655d265
--- /dev/null
+++ b/src/reducers/index.js
@@ -0,0 +1,8 @@
+//用于合并reducer
+import { combineReducers } from 'redux'
+import count from './count'
+import ui from './ui'
+export default combineReducers({
+ count,
+ ui
+})
\ No newline at end of file
diff --git a/src/reducers/ui.js b/src/reducers/ui.js
new file mode 100644
index 0000000000000000000000000000000000000000..03cf341bcf184482c484d6f85a2027da6a33bdc2
--- /dev/null
+++ b/src/reducers/ui.js
@@ -0,0 +1,5 @@
+export default () =>{
+ return {
+ title: 'holle world +'
+ }
+}
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..67fff5233c65cc7904eb855a56fe6d245537e20d
--- /dev/null
+++ b/src/store/index.js
@@ -0,0 +1,6 @@
+import { createStore, applyMiddleware } from 'redux'
+import thunk from 'redux-thunk'
+import rootReducers from '../reducers'
+
+// 不能直接传一个对象 必须合并后再传一个参数
+export default createStore(rootReducers, applyMiddleware(thunk))