You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/client/src/store.ts

23 lines
699 B
TypeScript

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<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch