Skip to main content

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

  1. Provides data. Components subscribe to the parts of the state they need using store.select(...) and receive updates whenever that data changes.

    ts
    this.store.select(selectUser).subscribe(user => { ... });
  2. Accepts actions. To change something, a component dispatches an action to the store through store.dispatch(...).

    ts
    this.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 reducers and effects.

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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.