15 lines
538 B
TypeScript
15 lines
538 B
TypeScript
import { configureStore } from '@reduxjs/toolkit';
|
|
import { counterSlice } from './components/steps';
|
|
import authReducer from './features/auth/authSlice';
|
|
|
|
export const store = configureStore({
|
|
reducer: {
|
|
counter: counterSlice.reducer,
|
|
auth: authReducer
|
|
},
|
|
});
|
|
|
|
// 从 store 本身推断 `RootState` 和 `AppDispatch` 类型
|
|
export type RootState = ReturnType<typeof store.getState>;
|
|
// 推断类型:{posts: PostsState, comments: CommentsState, users: UsersState}
|
|
export type AppDispatch = typeof store.dispatch; |