📜  错误:操作必须是普通对象.相反,实际类型是:'function'.您可能需要将中间件添加到您的商店设置中以处理调度其他值,例如“redux-thunk”来处理调度函数. - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:55.388000             🧑  作者: Mango

代码示例1
For me, the solution was to add `redux-thunk` as a middleware, so inside my 
store configuration file, I passed redux-thunk as middleware.

import reducerData from './store-reducer';
import {applyMiddleware, compose, createStore} from 'redux';
import ReduxThunk from 'redux-thunk';

const middlewares = [ReduxThunk];

const store = createStore(
reducerData,
compose(applyMiddleware(...middlewares)),
);
export default store;