Created
May 25, 2022 13:05
-
-
Save akashvaghela09/b692bb6861b887a2c8f695920b5bb8b3 to your computer and use it in GitHub Desktop.
Redux 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 { combineReducers, createStore, applyMiddleware, compose } from 'redux' | |
import { reducer as appReducer } from './app/reducer' | |
const rootReducer = combineReducers({ | |
app: appReducer | |
}) | |
const logger = (store) => (next) => (action) => { | |
// console.log("Dispatching Action Logger1", action, store.getState()) | |
const value = next(action) | |
// console.log("Now State in Logger1", store.getState()); | |
return value | |
} | |
const logger2 = (store) => (next) => (action) => { | |
// console.log("Dispatching Action Logger2", action, store.getState()) | |
const value = next(action) | |
// console.log("Now State in Logger2", store.getState()); | |
return value | |
} | |
const createComposer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose | |
const store = createStore(rootReducer, | |
createComposer( applyMiddleware(logger, logger2)) | |
) | |
export {store} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment