NGRX Flashcards
Definition
What is NGRX?
NGRX is a comprehensive state management solution for Angular applications that adopts the Redux pattern. It provides a clear and consistent model for managing the state, offering profound benefits in scalability and maintainability.
Definition
What is a Store?
RxJS-powered global state management for Angular, inspired by Redux.
Definition
NGRX Building Blocks
State, Actions, Reducers, Effects, and Selectors
Definition
What is State?
The entire data state of your application. The state is immutable and can only be changed by applying actions via reducers. An example would be:
interface AppState { cart: Array<Product>; }
Definition
What are Actions?
Actions express unique events, dispatched from components and services, and inform reducers how to change the state.
Definition
What is a Reducer?
Reducers handle transitions from one state to the next state. They are functions that handle transitions by determining which Actions need to be handled based on the Action’s type.
Definition
What are Effects?
Effects isolate side-effects from components. Side-effects are tasks such as reading DB data, calling APIs, etc.
Definition
What is a Selector?
Pure functions to obtain slices of the data in the store.
NGRX Architecture