Problem Statement
When should you use the OnPush change detection strategy?
Explanation
Use OnPush when your component inputs are immutable or you update state by replacing object references. It reduces checks to when inputs change, events fire from the component, or an observable emits via async pipe.
Code Solution
SolutionRead Only
@Component({ changeDetection: ChangeDetectionStrategy.OnPush })Practice Sets
This question appears in the following practice sets: