Lazy Loading Reducers in ngRx store

The ngRx store needs the reducers upfront coz it calls the combineReducers() at initialization and so if a module is set to load lazily, we still need that module’s reducers to be loaded upfront.

A way to get pure lazy loading is for each module to have it’s own Store, which is something that ngRx will be providing in the future.

An alternative hack is for us to override the combineReducers() and provide our own which allows for dynamically adding reducers (and hence state) to the same single store.



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