Whether change detection triggers a render depends on how you’ve setup your Angular component’s change detection strategy. By default, Angular watches all template-bound properties and will re-render.
OnPush, by contrast, effectively memo’s Inputs (read: props), and only re-renders when an Input value or ref has changed.
I just learned about using OnPush to optimize change detection last night. Having spent a few weeks with Angular now I'm less conflicted trying to connect the dots between React and Angular on what I'm confused by. It's taught like two separate schools of thought I can't reconcile yet. Frankly I'm not even sure which I prefer!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Whether change detection triggers a render depends on how you’ve setup your Angular component’s change detection strategy. By default, Angular watches all template-bound properties and will re-render.
OnPush, by contrast, effectively memo’s Inputs (read: props), and only re-renders when an Input value or ref has changed.
I just learned about using OnPush to optimize change detection last night. Having spent a few weeks with Angular now I'm less conflicted trying to connect the dots between React and Angular on what I'm confused by. It's taught like two separate schools of thought I can't reconcile yet. Frankly I'm not even sure which I prefer!