Platform: Question: Example-app, why extend the root state?

Created on 22 Feb 2018  路  3Comments  路  Source: ngrx/platform

Hello,
In this class, you extend the root State by adding additional state.
https://github.com/ngrx/platform/blob/master/example-app/app/auth/reducers/index.ts

export interface State extends fromRoot.State { auth: AuthState; }
why are you extending the fromRoot.State into a new interface State? Where do you use this new State interface? Are you adding a new state into the root State? Where do you use the states from the root State? Just in core module or also in feature modules?

Thanks

Most helpful comment

Ok. The root state interface is being extended so you get type information when using selectors and if you're using the feature state as the Store<T> in your components. If your feature module is completely independent of the root state, then you don't need to extend from the root state interface.

All 3 comments

Support questions should be asked on stackoverflow or the gitter channel.

Thanks @brandonroberts I asked there and no one answered me!

Ok. The root state interface is being extended so you get type information when using selectors and if you're using the feature state as the Store<T> in your components. If your feature module is completely independent of the root state, then you don't need to extend from the root state interface.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandonroberts picture brandonroberts  路  3Comments

axmad22 picture axmad22  路  3Comments

NathanWalker picture NathanWalker  路  3Comments

ghost picture ghost  路  3Comments

mappedinn picture mappedinn  路  3Comments