1

我遇到了一个错误createStore,我不明白为什么。

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);

该错误预计 Reducer 是一个函数。我正在使用 React Native 0.37 和最新版本的 redux、redux-thunk 和 redux-promise-middleware。reducers 是 combineReducers 的结果。

提前致谢。

4

1 回答 1

1
import * as reducers from './reducers';

这不可能reducers是一个函数。您将获得一个将每个导出作为属性的对象。你可能想要:

import reducers from './reducers';
于 2016-11-15T19:25:13.673 回答