Jason Warner
1 min readApr 13, 2020

--

This was a really good article. You have a lot of really good information along with some insightful reasons for why these are important things to know.

I would like to point out that using takeUntil() to stop subscriptions is no longer recommended. You can create a subscription in you code and add your subscriptions to that. Then when you clean up, you can then just unsubscribe from that one subscription. When a parent subscription unsubscribes all contained subscriptions unsubscribe.

const subs = new Subscription();
...
subs.add(observable$.subscribe());
...
// In cleanup
subs.unsubscribe(); // This unsubscribes from all subscriptions
// added through .add()

Some people don’t like all the parens added by this pattern. You can use [Subsink](https://github.com/wardbell/subsink) by Ward Bell to manage subscriptions in a similar manner. I’m not as familiar with the syntax, but it is pretty simple.

Thanks for sharing! I will be passing this link on to members of my team.

--

--

Jason Warner
Jason Warner

Written by Jason Warner

I enjoy everything related to code and being a dev. However, my only skills are showing up and being lucky and I'm not sure if luck is a talent.

Responses (1)