meteor / react-packages

Meteor packages for a great React developer experience
http://guide.meteor.com/react.html
Other
573 stars 158 forks source link

Fix atmosphere docs #206

Closed DimitryDushkin closed 6 years ago

DimitryDushkin commented 8 years ago

In example:

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);

Should be

import { createContainer } from 'meteor/react-meteor-data';

export default FooContainer = createContainer((props) => {
  // 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", props.id);

  return {
    currentUser: Meteor.user(),
    listLoading: ! handle.ready(),
    tasks: Tasks.find({listId: props.id}).fetch(),
  };
}, Foo);

There is no this.props, but we can get it from arguments.

abernix commented 6 years ago

This was updated. Thanks!