Change Detection, Immutability, OnPush Strategy in Angular (Tutorial)

  Рет қаралды 8,185

TheAngularCoder || Gourav

TheAngularCoder || Gourav

Күн бұрын

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

Пікірлер: 16
@jyk6107
@jyk6107 2 жыл бұрын
Another great tutorial, Thanks!
@GouravGunjan
@GouravGunjan 2 жыл бұрын
My pleasure!
@saikumardesu1700
@saikumardesu1700 2 жыл бұрын
Yeah, I was not comfort with this changing of object sub properties, thanks for explaining the onPush.
@GouravGunjan
@GouravGunjan 2 жыл бұрын
No worries!
@satisharyan49
@satisharyan49 3 жыл бұрын
nice edit
@GouravGunjan
@GouravGunjan 3 жыл бұрын
Thank you!
@VK-sn3sn
@VK-sn3sn 3 ай бұрын
in your opinion, which is the best considering general aspects. React or Angular?
@MultiWarrr
@MultiWarrr Жыл бұрын
Super like
@subha123007
@subha123007 2 жыл бұрын
what vscode plugin you are using for detecting git status.
@GouravGunjan
@GouravGunjan 2 жыл бұрын
GitLens.
@sabarinathan3297
@sabarinathan3297 2 жыл бұрын
Hi Actually we have application with around 30 modules with lazy loading , but whenever we edit any components it is taking 3minutes for every compilation. Do you have any idea about the issue? Spec: 8GB RAM, SSD ,I5 10th
@GouravGunjan
@GouravGunjan 2 жыл бұрын
I had same issue with my windows laptop. I switched to mac. Now the compile time is less than 30 secs. I tried increasing RAM, and other stuff to improve performance. But that was not resulting good. If you have 30 components, maybe you should break down application into smaller ones and publish them to artifactory (like npm). You can then resolve the dependency mein main app via package.json This is micro front end architecture. I hope that would reduce the compile time
@sabarinathan3297
@sabarinathan3297 2 жыл бұрын
@@GouravGunjan Thanks for the suggestion
@nallaparajuamareshvarma8471
@nallaparajuamareshvarma8471 Жыл бұрын
Can you also provide the Code in the description plz
@GouravGunjan
@GouravGunjan Жыл бұрын
Since this was purely based on tutorial. I placed the link to tutorial in the link. The idea is to get it done yourself once.
@swathitandle6720
@swathitandle6720 Жыл бұрын
why are you mentioning '?' before employee ""employee?''' in child component
This is the Best way to use Angular Web Workers
16:40
TheAngularCoder || Gourav
Рет қаралды 4,3 М.
RxJS tutorial in practical way (with pipe, map, filter, tap) 🔥
13:13
TheAngularCoder || Gourav
Рет қаралды 18 М.
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 21 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 49 МЛН
Vivaan  Tanya once again pranked Papa 🤣😇🤣
00:10
seema lamba
Рет қаралды 34 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Reduce Load Time in Angular upto 6x! | Learn Angular
17:03
TheAngularCoder || Gourav
Рет қаралды 9 М.
Change Detection Strategy in Angular
23:17
Fun Of Heuristic
Рет қаралды 47 М.
Angular 10 change detection - Onpush change detection strategy
17:07
JS Frameworks
Рет қаралды 2,8 М.
UI Interview experience with VmWare
9:23
TheAngularCoder || Gourav
Рет қаралды 2,8 М.
Change Detection in Angular - You Project Is 20x Slower!
15:16
Monsterlessons Academy
Рет қаралды 68 М.
Advanced #Angular Patterns - ForRoot & ForChild (2021, Decoded)
32:03
Decoded Frontend
Рет қаралды 47 М.
The new DestroyRef Provider in Angular 16 (2023)
11:42
Decoded Frontend
Рет қаралды 12 М.
Episode 8 | Angular Change Detection Strategy
16:54
Saikat's Tutorial
Рет қаралды 41 М.
ng-India Webinar | Simplifying Change Detection in Angular
1:45:25
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 21 МЛН