"Why you don't need the ngOnInit" - Maciej Wójcik | #9 Angular Meetup
ฝัง
- เผยแพร่เมื่อ 20 พ.ค. 2024
- We can often eliminate the need for ngOnInit and adopt more reactive techniques to increase the quality of our components. In this presentation, I will show you how to be more reactive, reduce setup code, and optimize performance.
Moreover, we will explore the View Model approach and how NgRx can assist us in this process.
Our ultimate objective is to reduce redundant code, improve readability, and boost the maintainability of Angular components.
0:00 Introduction
3:05 Why is ngOnInit overused?
4:51 Is the constructor a suitable replacement for ngOnInit?
7:04 Why subscribing in ngOnInit is not the best idea?
19:17 Reactive and declarative approach
28:09 Observables vs Promises
30:05 Explanation of the View Model pattern
35:12 NgRX - selectors in a nutshell
36:31 NgRX Component Store - outsourcing all logic
38:15 Questions and discussion
👉🏼 Check out our current recruitments at houseofangular.io/career/
🎬 The recording is from the #9 Angular Meetup event (23.05.2023)
Organizers: Angular Love
Sponsors: House of Angular,
Location: Jana Kazimierza 5, Warsaw
Looking for more Angular content? 👀 Don't miss more events!
Follow:
➡ House of Angular
Official website: houseofangular.io/
Facebook: / houseofangular
Instagram: / houseofangular
LinkedIn: / hous. .
Twitter: / houseofangular
➡ Angular Love
Official website: www.angular.love/
Facebook: / www.angular.. .
Twitter: / angularlovepl - วิทยาศาสตร์และเทคโนโลยี
Angular v16 with input params binding killed ngOnInit