What does Store do in NgRx?
In NgRx, Store is the central state store. It acts as the single source of truth for the whole application.
Simply put: Store holds the data components need and lets them react when that data changes.
It does two things:
Two main actions
-
Provides data. Components subscribe to the parts of the state they need using
store.select(...)and receive updates whenever that data changes.tsthis.store.select(selectUser).subscribe(user => { ... }); -
Accepts actions. To change something, a component dispatches an
actionto the store throughstore.dispatch(...).tsthis.store.dispatch(login({ email, password }));
Important
- The component doesn't change data directly. It just says: "something happened."
- The store itself decides how to update, through
reducersandeffects.
Summary
Store is like the brain of the application. All the state lives in one place, and any change happens only through clear steps. This provides control, predictability, and convenient debugging.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.