Skip to content

Commit

Permalink
Merge pull request #20 from Chamindu36/dev
Browse files Browse the repository at this point in the history
[T17] Add redux dev tool extension in chrome to see states, acions and changes
  • Loading branch information
Chamindu36 authored Aug 2, 2023
2 parents 3f9ba2f + 80bd3b8 commit b77816d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ const persistConfig = {

const persistedReducer = persistReducer(persistConfig, rootReducer);

const middleWares = [logger];
const middleWares = [process.env.NODE_ENV !== 'production' && logger].filter(Boolean);

const composedEnhancers = compose(applyMiddleware(...middleWares));
// Add dev tool extension in chrome to see states, acions and changes
const composeEnhancer =
(process.env.NODE_ENV !== 'production' &&
window &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose;

const composedEnhancers = composeEnhancer(applyMiddleware(...middleWares));

export const store = createStore(
persistedReducer,
Expand Down

0 comments on commit b77816d

Please sign in to comment.