import { Action, ThunkAction, configureStore } from '@reduxjs/toolkit'; import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; import { FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE, } from 'redux-persist'; import rootReducer from 'reducers/rootReducer'; const store = configureStore({ reducer: rootReducer, middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], }, }), }); export type RootState = ReturnType; export type AppDispatch = typeof store.dispatch; export type AppThunk = ThunkAction< ReturnType, RootState, unknown, Action >; export const useAppSelector: TypedUseSelectorHook = useSelector; export const useAppDispatch: () => AppDispatch = useDispatch; export default store;