I am finally trying to make the switch from Blaze to React and am having troubles to understand one simple concept I used all over the place with Blaze: template level subscriptions. I think I understand how subscriptions are done withTracker, but none of the examples I have found so far show how to stop the subscription. I want to understand how the blaze pattern of subscribing to data in the onCreated hook of a template and the automatic stopping of the subscription when destroying the template is done in react.
I believe the subscription is stopped when the component unmounts, so you may want to structure your app in such a way that components which are wrapped in withTracker get unmounted when their corresponding subscriptions are no longer needed.
Too much has changed in 3 years that I would want to use the react-meteor-subscribe wrapper.
I would have thought that the lifecycle method componentWillUnmount should be used to stop a subscription, but it doesn’t have access to the subscription handle created in the withTracker call