Skip to content

Instantly share code, notes, and snippets.

@pranitkhadilkar7
Created March 27, 2024 13:41
Show Gist options
  • Save pranitkhadilkar7/7e540d7a71b6e928d49c9801d782ce77 to your computer and use it in GitHub Desktop.
Save pranitkhadilkar7/7e540d7a71b6e928d49c9801d782ce77 to your computer and use it in GitHub Desktop.
src/store/store.ts file for RTK Query Setup
import { configureStore } from '@reduxjs/toolkit'
import { applicationApi } from './service'
import { setupListeners } from '@reduxjs/toolkit/query'
export const store = configureStore({
reducer: {
[applicationApi.reducerPath]: applicationApi.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(applicationApi.middleware),
})
// optional, but required for refetchOnFocus/refetchOnReconnect behaviors
setupListeners(store.dispatch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment