in Angular
@edbzn
Subscription ? 🤨
It’s an object that holds the Observable execution.
The component get destroyed
but the subscription lives on.
✖️ Avoid nested .subscribe().
✔️ Consider flattening operators instead.
✖️ Avoid .subscribe() in constructors.
✔️ Use lifecycle hooks instead.
✖️ Avoid logic in .subscribe().
Having logic in subscribe is usually an indicator that you're not using RxJS to its best potential.
✖️ Avoid subscription in services.
✔️ Reduce view subscriptions.
✖️ Don’t pass streams to components directly.
📌 Rx Scavenger library
📌 Until Destroy library
📌 Don't unsubscribe blog post
📌 Managing Subscriptions in Angular blog post
📌 When To Subscribe? (Rarely) blog post
📌 Detecting Memory Leaks blog post
Edouard Bozon
Angular, RxJS, NgRx, Node
🚴♂️ ⛷ 🍻
By Edouard Bozon