Created
March 27, 2016 12:53
-
-
Save dai-shi/eade73a6f6ac6575de62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx | |
| index 0f8372d..8f1bf8b 100644 | |
| --- a/imports/ui/App.jsx | |
| +++ b/imports/ui/App.jsx | |
| @@ -1,19 +1,14 @@ | |
| -import React, { Component } from 'react'; | |
| +import React, { Component, PropTypes } from 'react'; | |
| +import { createContainer } from 'meteor/react-meteor-data'; | |
| + | |
| +import { Tasks } from '../api/tasks.js'; | |
| import Task from './Task.jsx'; | |
| // App component - represents the whole app | |
| -export default class App extends Component { | |
| - getTasks() { | |
| - return [ | |
| - { _id: 1, text: 'This is task 1' }, | |
| - { _id: 2, text: 'This is task 2' }, | |
| - { _id: 3, text: 'This is task 3' }, | |
| - ]; | |
| - } | |
| - | |
| +class App extends Component { | |
| renderTasks() { | |
| - return this.getTasks().map((task) => ( | |
| + return this.props.tasks.map((task) => ( | |
| <Task key={task._id} task={task} /> | |
| )); | |
| } | |
| @@ -32,3 +27,13 @@ export default class App extends Component { | |
| ); | |
| } | |
| } | |
| + | |
| +App.propTypes = { | |
| + tasks: PropTypes.array.isRequired, | |
| +}; | |
| + | |
| +export default createContainer(() => { | |
| + return { | |
| + tasks: Tasks.find({}).fetch(), | |
| + }; | |
| +}, App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment