我已经用redux创建了两个API组件,然后我想在商店中调用它们,这是我写的代码
import { configureStore} from "@reduxjs/toolkit";
import {cryptoApi} from '../services/cryptoApi';
import {cryptoNewsApi} from '../services/cryptoNewsApi'
export default configureStore({
reducer: {
[cryptoApi.reducerPath]: cryptoApi.reducer,
[cryptoNewsApi.reducerPath]: cryptoNewsApi.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(cryptoApi.middleware),
// middleware: (getDefaultMiddleware) =>
// getDefaultMiddleware().concat(cryptoNewsApi.middleware),
});
它没有工作,所以我意识到我应该添加cryptoNewsApi到中间件太我怎么能做到这一点
1条答案
按热度按时间62lalag41#