Several states in the same feature module

The following scenario can be found in the Chapter9/TypesDemo folder of the code repository. 

OK, so now we know about the ActionReducerMap type, and we also know that we can provide a type to the forFeature() method and make it safer to use. What happens if we've got several states in our feature module, what then? The answer is quite simple, but let's first have a closer look at what we mean exactly by several states. Our counter module contains the counter.value state. This is displayed in our counter.component.ts. If we want to add a counter.list state, we need to add the supporting constants, reducers, actions, and a component file so we can properly display it. Our file structure should therefore look like the following:

/counter
counter.reducer.ts
counter.component.ts
counter.constants.ts
counter.actions.ts
/counter-list
counter-list.reducer.ts
counter-list.component.ts
counter-list.constants.ts
counter-list.action.ts
counter.model.ts
counter.module.ts

We need to add implementation for all of these bold files.

..................Content has been hidden....................

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