Skip to content

Commit

Permalink
fix issue with redux HMR (reduxjs/redux#667 (comment))
Browse files Browse the repository at this point in the history
  • Loading branch information
maullerz committed Nov 21, 2016
1 parent 9a51ed9 commit 69947a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@ ReactDOM.render((
</Provider>
), document.getElementById('root')
);


if (module.hot) {
module.hot.accept();

// fix hot module replacement for reducers
module.hot.accept('./ducks/index', () => {
const nextRootReducer = require('./ducks/index');

store.replaceReducer(nextRootReducer);
});
}
9 changes: 0 additions & 9 deletions src/redux-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,5 @@ export default function configureStore(initialState) {
);
}


if (module.hot) {
module.hot.accept('./ducks/index', () => {
const nextRootReducer = require('./ducks/index');

store.replaceReducer(nextRootReducer);
});
}

return store;
}

0 comments on commit 69947a3

Please sign in to comment.