Manoj
Manoj

Reputation: 5867

Can I dispatch root actions from feature store in ngrx?

I'm new to ngrx. I'm little confused in dispatching actions.

State:

{
    uiState: UIState,
    featureState: FeatureState
}

From my feature effects, I need to dispatch a UI action. So I injected Store<State> and dispatch. It worked fine.

But, if I use Store<featureState> and dispatch UI action, this also works fine.

I thought, if I dispatch a UI action from feature store, the store will not know which reducer to call for that action and get a default state. But the value in the uistate is updated.

So, does this mean I can dispatch any action from anywhere?

Upvotes: 1

Views: 629

Answers (1)

Andrew Hill
Andrew Hill

Reputation: 2253

Yes - you can dispatch any action from anywhere.

Upvotes: 3

Related Questions