-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
24 lines (20 loc) · 822 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { configureStore } from "@reduxjs/toolkit";
import { authSlice } from "./features/auth/authSlice";
import { walletSlice } from "./features/wallet/walletSlice";
export const storeFn = () => {
return configureStore({
reducer: {
[authSlice.name]: authSlice.reducer,
[walletSlice.name]: walletSlice.reducer,
},
middleware: (getDefaultMiddleware) => getDefaultMiddleware(),
devTools: true,
});
};
export const store = storeFn();
export type AppStore = typeof store;
export type AppState = ReturnType<AppStore["getState"]>;
// 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;