我使用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不是调度的函数。
我如何才能做到这一点呢?
发布于 2016-03-24 10:05:27
答案是:这取决于dispatch返回的内容;如果返回了promise,那么它将被启用。
https://stackoverflow.com/questions/36189448
复制相似问题