Configuring Multiple API's #3900
Answered
by
markerikson
jd-carroll
asked this question in
Q&A
-
Background:
My question is twofold:
[Basic] Configuration export const FacebookApi = createApi({
reducerPath: 'fb-api',
baseQuery: fetchBaseQuery({ baseUrl: fbUrl }),
endpoints: () => ({})
});
export const CarRentalApi = createApi({
reducerPath: 'vroom-api',
baseQuery: fetchBaseQuery({ baseUrl: honkUrl }),
endpoints: () => ({})
});
const reducer = combineReducers({
[FacebookApi.reducerPath]: FacebookApi.reducer,
[CarRentalApi.reducerPath]: CarRentalApi.reducer
})
const ListenerMiddleware = createListenerMiddleware()
const store = configureStore({
reducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware()
.prepend(ListenerMiddleware.middleware)
.concat(logger, FacebookApi.middleware, CarRentalApi.middleware)
}); |
Beta Was this translation helpful? Give feedback.
Answered by
markerikson
Nov 21, 2023
Replies: 1 comment
-
Yep, that looks right. Each API middleware that you add to the store does add some fixed amount of overhead in terms of processing checks that are done against every dispatched action. 2 API middleware added is okay. 30 is too much :) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jd-carroll
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep, that looks right.
Each API middleware that you add to the store does add some fixed amount of overhead in terms of processing checks that are done against every dispatched action. 2 API middleware added is okay. 30 is too much :)