State Management & Change Detection Flashcards
6 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 State Management & Change Detection flashcards as text
Which NgRx action creator helper generates a typed action with an optional payload?
Answer: createAction()
createAction() produces a strongly-typed action creator function, optionally using props() to define the payload shape.
What is the main benefit of immutable state updates in NgRx reducers?
Answer: Enables time-travel debugging and predictable state history
Immutable updates preserve previous state snapshots, enabling DevTools time-travel, replay, and deterministic state transitions.
Which Angular Signals API schedules a side effect that reruns whenever its dependent signals change?
Answer: effect()
effect() registers a reactive side effect that Angular automatically re-executes whenever any signal it reads changes.
What does the on() helper inside createReducer() do?
Answer: Registers a case handler for a specific action type
on(ActionCreator, (state, action) => newState) registers a handler inside createReducer() for a specific action.
Which decorator marks a class as an NgRx state feature slice and automatically registers selectors?
Answer: createFeature()
createFeature() combines a feature name, reducer, and extra selectors into a single object and auto-generates a feature selector.
In Angular change detection, what is a 'dirty' component?
Answer: A component marked to be checked in the next detection cycle
A dirty component has been flagged (e.g., via markForCheck()) and will be re-evaluated during the next change detection pass.