[英]Unable to handle error: `middleware is not a function' in redux-promise-middleware?
I am trying to use redux-promise-middleware in my app, but when I am trying to run my app error comes with an error message: 'middleware is not a function or middleware is null'. 我正在尝试在我的应用程序中使用redux-promise-middleware,但是当我尝试运行我的应用程序时,错误出现了一条错误消息:“中间件不是函数或中间件为空”。
I tried to use middleware without a function as suggested in redux async docs, but still error is coming. 我试图使用Redux异步文档中建议的不带功能的中间件,但仍然会出现错误。
configureStore.js 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 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);
Please anybody, suggest to me that why I am facing this error. 请任何人向我建议为什么我要面对这个错误。 I am new to redux. 我是Redux的新手。
import promiseMiddleware from 'redux-promise-middleware';
composeStoreWithMiddleware = applyMiddleware(
promiseMiddleware,
)(createStore);
And not : PromiseMiddleware() 不是:PromiseMiddleware()
(not uppercase and w/o () ) (不是大写,没有())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.