我使用 redux、react-redux、react-router、react-router-redux 和 redux-thunk。
import { createStore, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { browserHistory } from 'react-router'
import { routerMiddleware } from 'react-router-redux'
import thunkMiddleware from 'redux-thunk'
...
const reduxRouterMiddleware = routerMiddleware( browserHistory )
const store = createStore(
mainReducer,
applyMiddleware(reduxRouterMiddleware, thunkMiddleware)
)
我希望因此能够进行可调度
dispatch(...).then()
但我收到的消息then
不是调度功能。
我怎样才能做到这一点?