12345678910111213141516171819202122232425262728293031323334353637 |
- // App component : represents the whole app.
- App = React.createClass({
- // 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() {
- return this.data.tasks.map((task) => {
- // Meteor._debug(task._id);
- return <Task key={task._id} task={task} />;
- });
- },
- render() {
- return (
- <div className="container">
- <header>
- <h1>Todo list</h1>
- </header>
- <ul>
- {this.renderTasks()}
- </ul>
- </div>
- );
- }
- });
|