Angular

NgRx Fundamentals

Store, actions, reducers, selectors, effects, state immutability, Redux pattern, NgRx DevTools

24 interview questionsยท
Senior
1

What is NgRx Store in an Angular application?

Answer

NgRx Store is a Redux pattern implementation for Angular, based on RxJS. It provides a centralized container for managing application global state in a predictable and immutable way. The Store exposes an Observable that allows components to subscribe to state changes via selectors.

2

What is the main role of an Action in NgRx?

Answer

An Action in NgRx is a simple object that describes an event that occurred in the application. It must contain a 'type' property (unique string) and optionally a 'payload' with data. Actions are the only way to trigger state changes in the Store via reducers.

3

How to create an NgRx Action with the createAction function?

Answer

The createAction function allows creating typed Actions in a concise way. It takes a unique string type as first parameter and optionally properties via props<T>(). This modern approach replaces action classes and provides better type inference with TypeScript.

4

What is a Reducer in NgRx?

5

Why is state immutability essential in NgRx?

+21 interview questions

Master Angular for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free