This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
Event handlers complain when attaching component method #37
Open
Description
I have added an onClick handler to the group component but I am getting this warning in my console:
bind(): React component methods may only be bound to the component instance. See Component
Here is a shortened version of my component which exhibits the warning. (Plain JS, no JSX)
var Component = React.createClass({
displayName: 'Component',
handleClick: function (event) {
console.log('Clicked!');
},
render: function () {
return (
Surface({ width: 320, height: 480 },
Group({ onClick: this.handleClick })
)
);
}
});
I believe it has to do with the fact that Group is a React component and that it should only be binding its own methods to the event listener. Is there a way to put this together without getting this warning?
Metadata
Metadata
Assignees
Labels
No labels