ngrx-store-hmr
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@ngrx/store HMR

Experimental HMR support for @ngrx/store based on angular2-hmr

Setup

In order for your application to have HMR support, you need to wrap your bootstrap call in a function that receives an optional HMR state object:

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);
}

Dependents (0)

Package Sidebar

Install

npm i ngrx-store-hmr

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • mikeryan52