我正在使用React教程研究Meteor并尝试理解createContainer().从这里阅读:
http://guide.meteor.com/v1.3/react.html#using-createContainer
我认为它定义的函数meteor/react-meteor-data用于数据加载.在这种特定情况下,它从Mini Mongo数据库(Task此处命名)中检索数据.我的问题是,createContainer的第二个参数是做什么的?(App在此命名).谢谢!
class App extends Component {
//...class definition
}
export default createContainer(() => {
return {
//Tasks is a Mongo.Collection
//returns the matching rows (documents)
//here we define the value for tasks member
tasks: Tasks.find({}, { sort: { createdAt: -1} }).fetch(),
};
}, App);
Run Code Online (Sandbox Code Playgroud)