|
@@ -1,16 +1,22 @@
|
|
// App component : represents the whole app.
|
|
// App component : represents the whole app.
|
|
|
|
|
|
App = React.createClass({
|
|
App = React.createClass({
|
|
- getTasks() {
|
|
|
|
- return [
|
|
|
|
- { _id: 1, text: "This is task 1" },
|
|
|
|
- { _id: 2, text: "This is task 2" },
|
|
|
|
- { _id: 3, text: "This is task 3" }
|
|
|
|
- ];
|
|
|
|
|
|
+
|
|
|
|
+ // This mixin makes the getMeteorData work.
|
|
|
|
+ mixins: [ReactMeteorData],
|
|
|
|
+
|
|
|
|
+ // Loads items from the Tasks collection and puts them on this.data.tasks.
|
|
|
|
+ getMeteorData() {
|
|
|
|
+ let result = {
|
|
|
|
+ tasks: Tasks.find({}).fetch()
|
|
|
|
+ };
|
|
|
|
+ // Meteor._debug("result", result);
|
|
|
|
+ return result;
|
|
},
|
|
},
|
|
|
|
|
|
renderTasks() {
|
|
renderTasks() {
|
|
- return this.getTasks().map((task) => {
|
|
|
|
|
|
+ return this.data.tasks.map((task) => {
|
|
|
|
+ // Meteor._debug(task._id);
|
|
return <Task key={task._id} task={task} />;
|
|
return <Task key={task._id} task={task} />;
|
|
});
|
|
});
|
|
},
|
|
},
|