Skip to main content

What is ChangeDetectionStrategy.OnPush and when should you use it?

Entry Angular
Quick Answer OnPush change detection tells Angular to only check a component when: its input references change (shallow comparison), an event originates from the component or its children, or async pipe receives a new value, or detectChanges() is called manually. This dramatically reduces the number of checks. Use for "dumb" components that only render inputs. Combined with immutable data, it eliminates unnecessary re-renders.

Answer

OnPush change detection checks a component only when its input reference changes, an event occurs, or an observable emits.

It improves performance in large, data-heavy applications by reducing unnecessary change detection cycles.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice