πŸ“Š Angular
Q. How do you mark a component to use OnPush change detection?
  • (A) Add changeDetection: ChangeDetectionStrategy.OnPush in @Component
  • (B) Add @OnPush decorator to class
  • (C) Import OnPushModule
  • (D) Use ngOnChanges lifecycle hook
πŸ’¬ Discuss
βœ… Correct Answer: (A) Add changeDetection: ChangeDetectionStrategy.OnPush in @Component

Explanation: OnPush strategy improves performance by checking only when input references change.

Explanation by: Mr. Dubey
OnPush strategy improves performance by checking only when input references change.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
50
Total Visits
πŸ“½οΈ
8 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
84%
Success Rate