import { configureStore } from '@reduxjs/toolkit' import context from './slices/context'; import action from './slices/action'; import storage from 'redux-persist/lib/storage'; import { combineReducers } from 'redux'; import { persistReducer } from 'redux-persist'; import thunk from 'redux-thunk'; const reducers = combineReducers({ context: context, action: action }); const persistConfig = { key: 'root', storage, }; const persistedReducer = persistReducer(persistConfig, reducers); export const store = configureStore({ reducer: persistedReducer, devTools: true, middleware: [thunk], }); // 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