我试图在我的应用程序中使用redux承诺中间件,但是当我试图运行我的应用程序时,错误会带来一条错误信息:“中间件不是函数,中间件是空的”。
--我尝试使用没有函数的中间件,就像Redux异步文档中所建议的那样,但是仍然会出现错误。
configureStore.js
import { createStore, applyMiddleware } from 'redux'
import app from './reducers/index';
import PromiseMiddleware from 'redux-promise-middleware';
const configureStore = () => {
let middleware = applyMiddleware(PromiseMiddleware());
let store = createStore(app, middleware);
return store
};
export default configureStore;index.js
import React from 'react'
import { AppRegistry } from 'react-native';
import App from './App';
import { Provider } from 'react-redux'
import configureStore from './configureStore'
const store = configureStore();
const ReduxMiddleware = () => {
<Provider store={store}>
<App />
</Provider>
}
AppRegistry.registerComponent('ReduxMiddleware', () => ReduxMiddleware);请任何人,告诉我为什么我要面对这个错误。我是新来的..
发布于 2019-09-18 11:14:12
import promiseMiddleware from 'redux-promise-middleware';
composeStoreWithMiddleware = applyMiddleware(
promiseMiddleware,
)(createStore);而不是: PromiseMiddleware()
(非大写和w/o () )
https://stackoverflow.com/questions/57990383
复制相似问题