@ngrx/store middleware to connect store state to the Angular2-HMR API
npm install ngrx-store-hmr``ts
import { hotModuleReplacement } from 'ngrx-store-hmr';
// Wrap bootstrap in a function that accept an optional hmrState
function main(hmrState?: any) {
return bootstrapp(App, [
provideStore(reducer, hmrState)
]);
}
if(module.hot) {
hotModuleReplacement(main, module);
}
else {
document.addEventListener('DOMContentLoaded', () => main);
}
``