Using ngrx store freeze

  • The problem with mutability is that if we do it in the reducer, there won’t be any error, but the store subscribers and selectors won’t be triggered. Hence it’s imp. to enforce immutability of store, so that mutating throws compile time error allowing us to fix it and make reducers pure functions and store immutable.
  • This is not recommended in prod, as it uses Object.freeze, which is not supported by all browsers.


code changes:

import { storeFreeze } from 'ngrx-store-freeze';
StoreModule.provideStore(compose(storeFreeze, reducer))



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s