-
-
Save AllGistsEqual/cfe07c5c677ee5b9eff7ee53ca399c27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: src/redux/index.ts | |
import { configureStore } from '@reduxjs/toolkit' | |
import { useDispatch, useSelector, TypedUseSelectorHook } from 'react-redux' | |
import { createBrowserHistory } from 'history' | |
import rootReducer from './rootReducer' | |
export const history = createBrowserHistory() | |
const store = configureStore({ | |
reducer: rootReducer(history), | |
// middleware: getDefaultMiddleware => getDefaultMiddleware(), // .prepend(middleware) | |
}) | |
export type RootState = ReturnType<typeof store.getState> | |
export type AppDispatch = typeof store.dispatch | |
export const useReduxDispatch = (): AppDispatch => useDispatch<AppDispatch>() | |
export const useReduxSelector: TypedUseSelectorHook<RootState> = useSelector | |
export default store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment