Practical Angular: The Most Impactful RxJs Best Practice Of All Time
--
OK, OK, the heading might be a bit sensational but hear me out… This easy to follow tip can help YOU and your teammates to simplify and hence improve your projects significantly!
💎 The article is based on extended experience from a large enterprise environment with more than 140 Angular SPAs and 30 libraries…
🤫 Wanna know how we can manage such a large environment without going full crazy 😵 Check out Omniboard!😉
As you can probably imagine, such an environment also translates into lots of people working tirelessly on the codebases of those projects to deliver new features for their users! These people often have to work in full-stack mode to be able to meet everchanging demands and prioritization.
This lack of focus also often goes hand in hand with little experience and hence unfamiliarity with reactive programming which is pretty different from more common imperative way of doing things!
👨🍳️ To summarize, following ingredients:
- huge amount of projects
- full-stack development mode and lack of focus
- unfamiliarity with reactive programming
provide us with opportunity to uncover some of the recurring patterns of RxJs usage that may look OK on the surface but will lead to problems and hard to understand code if left unchecked!
The Problem
One of the most common and straight forward problem to solve is situation when RxJs streams are being re-created during component (or service) lifetime as a reaction to some user interaction or event like receiving response from a backend…
TLDR; THE TIP
It is ALWAYS possible to FULLY define a RxJs stream from the start! We can include…