Redux thunk in native native

时间:2016-11-15 19:13:26

标签: reactjs react-native redux redux-thunk react-thunk

我在createStor上得到错误,我不明白为什么

import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import thunk from "redux-thunk"
import promise from "redux-promise-middleware"
import * as reducers from './reducers';

const middleware = applyMiddleware(promise(), thunk);

export default createStore(reducers, middleware);

上面是我的代码,我在行

中得到错误
const middleware = applyMiddleware(promise(), thunk);

错误是预期减速器是一个功能。 我正在使用React Native 0.37和最新版本的redux,redux-thunk和redux-promise-middleware。 reducer是combineReducers的结果。

提前致谢。

1 个答案:

答案 0 :(得分:1)

import * as reducers from './reducers';

reducers无法发挥作用。您将获得每个导出为对象的对象。你可能想要:

import reducers from './reducers';