Sergey Gultyayev
1 min readJul 29, 2022

--

I disagree. Writing optimal code and optimizing are different things.

If one was to use ngZone.runOutsideAnguloar() every time - it's premature optimization.

Using OnPush - is not the same as Rect's `memo` and it only reduces amount of checks over the tree. No memoization or whatsoever.

> It's also true that if Angular team wanted to encourage developers to use OnPush as default strategy, they would make it so.

Not quite. Default is a conventient strategy which improves the DX and so that is default.

Using OnPush is not a big overhead and does not require you to spend time to use it. Over-optimization is bad because you have to spend time on it, while the benefits are questionable. Here I don't see such a case.

P.S. Default strategy makes Angular more accessible by new developers who don't know much about Change Detection which is a big topic itself in the Angular world.

--

--

Sergey Gultyayev
Sergey Gultyayev

Written by Sergey Gultyayev

A front-end developer who uses Angular as a main framework and loves it

No responses yet