添加中间件

This commit is contained in:
zwjamnsss 2017-07-12 11:39:06 +08:00
parent ef337dc18d
commit 3cf7190745
2 changed files with 12 additions and 3 deletions

View File

@ -1,13 +1,21 @@
import React from 'react'
import 'babel-polyfill'
import thunkMiddleware from 'redux-thunk'
import promiseMiddleware from 'redux-promise';
import ReactDOM from 'react-dom'
import App from './App'
import { createStore, combineReducers } from 'redux'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import ReduxContainer from './ReduxContainer.js'
console.log('thunkMiddleware', thunkMiddleware)
console.log('promiseMiddleware', promiseMiddleware)
// 合并 redux 创建stroe
const store = createStore(combineReducers( ReduxContainer ))
const store = createStore(combineReducers( ReduxContainer ), applyMiddleware(
thunkMiddleware.default,
promiseMiddleware
))
ReactDOM.render(
<Provider store={store}>

View File

@ -31,8 +31,9 @@
"mongoose-auto-increment": "^5.0.1",
"node-sass-china": "^4.5.0",
"prop-types": "^15.5.10",
"sha1": "^1.1.1",
"redux": "^3.7.1",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.2.0",
"sha1": "^1.1.1",
"ykit-config-antd": "^0.1.3",
"ykit-config-react": "^0.4.4"