Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
feat: add redux devtools (#163)
Browse files Browse the repository at this point in the history
* feat: add redux dev tools
  • Loading branch information
ImmanuelSegol authored Apr 16, 2019
1 parent 7f22fe5 commit 2aaee10
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@ import thunk from 'redux-thunk';
import createRootReducer from './rootReducer';
import logger from 'redux-logger';

// Check if we are in production
const production = process.env.NODE_ENV === 'production';

// If we are in production dont use devtools-extension-compose
const composeEnhancers =
!production && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
name: 'boltz',
actionsBlacklist: ['REDUX_STORAGE_SAVE'],
serialize: true,
trace: true,
})
: compose;

// Select middelware to use
let middelware = [thunk];

if (process.env.NODE_ENV !== 'production') {
if (!production) {
middelware = [...middelware, logger];
}

const store = createStore(
createRootReducer(),
compose(applyMiddleware(...middelware))
);
const enhancer = composeEnhancers(applyMiddleware(...middelware));
const rootReducer = createRootReducer();
const store = createStore(rootReducer, enhancer);

export default store;

0 comments on commit 2aaee10

Please sign in to comment.