Created
December 1, 2020 23:50
-
-
Save mentix02/61a8101d09d259c75bd9bfdfe6e87462 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { createLogger } from "redux-logger"; | |
import storage from "redux-persist/lib/storage"; | |
import { persistStore, persistReducer } from "redux-persist"; | |
import { compose, createStore, applyMiddleware } from "redux"; | |
import { rootReducer } from "./reducer"; | |
const persistConfig = { | |
key: "root", | |
storage: storage, | |
}; | |
const persistedReducer = persistReducer(persistConfig, rootReducer); | |
const composeEnhancers = | |
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | |
const store = createStore( | |
persistedReducer, | |
composeEnhancers(applyMiddleware(createLogger())) | |
); | |
export const persistor = persistStore(store); | |
export default store; |
This file contains hidden or 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
import authReducer from "./auth/reducers"; | |
import { combineReducers } from "redux"; | |
export const rootReducer = combineReducers({ | |
auth: authReducer, | |
}); | |
export type RootState = ReturnType<typeof rootReducer>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment