I use publish to publish data to use it inside React component:
Meteor.publish('user.role', function(){
if (!this.userId) {
return this.ready();
}
return Meteor.users.find({_id: this.userId});
});
I only need one user property that is inside and it’s role property.
Then I subscribe to this in my React component:
componentWillMount() {
data = Meteor.subscribe('user.role');
}
But how do I get that one property? When I want to use fetch() on the client it shows me that there is no such function but I cannot use it in the publication because it can only return cursor.
What should I do?