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

Experimental HMR support for @ngrx/store

Notifications You must be signed in to change notification settings

CodeSequence/ngrx-store-hmr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@ngrx/store HMR

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

Setup

First install the library:

npm install ngrx-store-hmr --save-dev

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 { provideStore } from '@ngrx/store';
import { hotModuleReplacement } from 'ngrx-store-hmr';
import { reducer } from './reducer';

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

About

Experimental HMR support for @ngrx/store

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published