I have just started ngRx and I am facing a small issue.
I would like to know the difference between the keys of both interface states and modules forRoot.
export interface ConfigurationState {
readonly configuration: Configuration;
}
StoreModule.forRoot({
configuration: ConfigurationReducer,
}),
export function configurationReducer(state: Configuration = undefined, action: ConfigurationActions.Actions): Configuration {
switch (action.type) {
case ConfigurationActions.SET:
return action.payload;
default:
return state;
}
}
this.store.select('configuration')
When I select a store with the 4th piece of code, I see an intellisense help for the keys of the 1st piece of code.
If I change the key of the 2nd piece of code, it doesn't change anything.
So my question is, what is the purpose of forRoot ? Are the keys important ?