Initial Expo base app config with Redux

This commit is contained in:
Patrick Fic
2020-08-05 21:39:25 -07:00
parent ce1f58dbd8
commit 53360b1d5e
16 changed files with 6408 additions and 13 deletions

26
redux/store.js Normal file
View File

@@ -0,0 +1,26 @@
import { createStore, applyMiddleware, compose } from "redux";
import { persistStore } from "redux-persist";
import { createLogger } from "redux-logger";
import createSagaMiddleware from "redux-saga";
import rootReducer from "./root.reducer";
import rootSaga from "./root.saga";
const sagaMiddleWare = createSagaMiddleware();
const middlewares = [sagaMiddleWare];
if (process.env.NODE_ENV === "development") {
middlewares.push(createLogger({ collapsed: true, diff: true }));
}
const enhancer = compose(
applyMiddleware(...middlewares)
// other store enhancers if any
);
export const store = createStore(rootReducer, enhancer);
sagaMiddleWare.run(rootSaga);
export const persistor = persistStore(store);
export default { store, persistStore };