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