import { configureStore } from '@reduxjs/toolkit'; import { connection } from './connection' import thunkMiddleware from 'redux-thunk' import { gameApi } from './game/api' export const store = configureStore({ reducer: { [gameApi.reducerPath]: gameApi.reducer, }, middleware: getDefaultMiddleware => getDefaultMiddleware({ thunk: { extraArgument: { connection } } }).concat(gameApi.middleware), }); // Infer the `RootState` and `AppDispatch` types from the store itself export type RootState = ReturnType // Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} export type AppDispatch = typeof store.dispatch