【发布时间】:2016-11-19 00:53:10
【问题描述】:
看不懂react-meteor-data这个例子
import { createContainer } from 'meteor/react-meteor-data';
export default FooContainer = createContainer(() => {
// Do all your reactive data access in this method.
// Note that this subscription will get cleaned up when your component is unmounted
var handle = Meteor.subscribe("todoList", this.props.id);
return {
currentUser: Meteor.user(),
listLoading: ! handle.ready(),
tasks: Tasks.find({listId: this.props.id}).fetch(),
};
}, Foo);
为什么在卸载Component 时推荐stop 订阅,但在这种情况下,没有努力阻止任何事情?那么 Meteor 是如何处理订阅的呢?什么时候清理收藏品?每次执行跟踪器回调时,订阅是否都会堆积?
或者 Meteor 是否足够聪明,可以知道何时调用 Meteor.subscribe 并对订阅施展魔法?
【问题讨论】:
标签: javascript meteor