Reputation: 1512
Meteor / React newb here and I'm having a problem upgrading from createContainer
(which is depreciated) to withTracker
in the following.
export default createContainer(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
I've tried the following...
import { withTracker } from 'meteor/react-meteor-data';
.....
export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
but I'm getting errors in the console :
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
Could somebody show me where I'm going wrong please?
Upvotes: 1
Views: 282
Reputation: 8229
This seems to be a syntax error in the last line of your code snippet
export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
Replace it with
export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
})(UsersList);
Upvotes: 1