I happened to see ChangeDetectionStrategy
in the ngrx documentation. It uses OnPush
.
What is ChangeDetectionStrategy
in Angula
Use OnPush
strategy if your objects are immutable and you don't change the state of the objects in your component. It will perform better rather than default where each change of the object makes run change detector to resolve changes. More or less similar is described in Change Detection Strategy: OnPush
To inform Angular that we are going to comply with the conditions mentioned before to improve performance, we will use the
OnPush
change detection strategy
The Angular docs said
ChangeDetectionStrategy:
OnPush
means that the change detector's mode will be set toCheckOnce
during hydration.
Default
means that the change detector's mode will be set toCheckAlways
during hydration.