Leveraging types and feature modules

The following files is pointing to the demo project Chapter9/FeatureModules.

OK, one thing we can definitely improve is how we tell the StoreModule about what state and reducers exist in our app. Let's do a quick recap and look at its current state:

// from app.module.ts

StoreModule.forRoot({ count: counterReducer, jediList: JediListReducer })

So, we are essentially feeding the forRoot() method an object. What's wrong with that? Well, imagine you have ten different feature modules and every feature module may have three to four states, then the object you pass to forRoot() will grow in size and the number of imports that you need to do in your app.module.ts will grow. It will look something like this:

StoreModule.forRoot({ 
featureModuleState1: featureModuleState1Reducer,
featureModuleState2 : featureModuleState2Reducer
.
.
.
.
.
.
.
.
})
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.190.41