Рет қаралды 8,185
With live code, let's understand how change detection works in Angular, what is immutability and how we can leverage onPush strategy.
With the advent of Redux, immutable update patterns have become widely popular. In a nutshell, the idea is to create a new object instead of altering the existing one when you need to perform an update action. When it comes to Angular applications, the immutability term is mostly mentioned when you deal with the OnPush change detection strategy in order to improve a runtime performance.
However, sticking to mutable update patterns may not only prevent you from taking advantage of narrowing a components tree subjected to the change detection process, but it also leads to some hard to spot bugs/gotchas.
Please like, share and subscribe for more content like this. You can follow me and directly ask questions on:
Groups and Pages:
Reddit Community: / theangularcoder
LinkedIn Group: / 13984152
Facebook Page: / theangularcoder
Discord Community: / discord
Personal:
Reddit: / gouravgunjan
Discord username: gouravgunjan#3168
Dev.to: dev.to/gourav_gunjan
LinkedIn Personal: / gouravgunjan
=== Chapters ===
00:00 - Intro
00:50 - Change Detection (layman)
03:18 - Immutability
04:33 - Live Code - Bad example
10:30 - What happens with OnPush
12:21 - Fixing code for OnPush
14:12 - Fix for initial bug
15:59 - Conclusion