Hi. I have a react hooks component that uses useTracker, similar to how I see it used in various how-tos
export const MyComponent = () => {
const { items, loading } = useTracker(() => {
const subscription = Meteor.subscribe('mySubscription');
if (subscription.ready()) {
return { items: Items.find().fetch(), loading: false };
}
return { items: [], loading: true };
});
}
Now, I notice that when this component unmounts, the ‘unsubscription’ is automatic, although I don’t call subscription.stop() explicitly anywhere. This is great in most cases, but what if I don’t want it to automatically unsubscribe when the component unmounts? Is there a way to hang on to the subscription so that I can choose exactly when to call subscription.stop() (some time after the unmount) ?