流星/ React newb在这里,我在以下情况下从createContainer
(已贬值)升级到withTracker
时遇到了问题。
export default createContainer(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
我尝试了以下方法...
import { withTracker } from 'meteor/react-meteor-data';
.....
export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
但是控制台出现错误:
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.
有人可以告诉我我要去哪里了吗?
答案 0 :(得分:0)
这似乎是代码段最后一行中的语法错误
export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
}, UsersList);
用
替换export default withTracker(() => {
Meteor.subscribe('users', PER_PAGE);
return { users: Users.find({}).fetch() };
})(UsersList);