I called .jsx code of React below in foo.html
<div>
{{> React component=UserAvatar userId=_id onClick=onClick}}
</div>
But it displayed nothing in online myapp.meteor.com, it displayed right userid and email in localhost:3000.
what could be wrong? Any right way to use callback functions?
in index.jsx.sml
var UserAvatar = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
return {
currentUser: Meteor.user()
};
},
render() {
var curuser = this.data.currentUser;
return <span>UserID: {curuser._id} Email: {curuser.emails}</span>;
}
});
Template.simplereact.helpers({
UserAvatar() {
return UserAvatar;
},
onClick() {
var self = Template.instance();
return function () {
self.hasBeenClicked.set(true)
}
}
});