It appears there's a simple answer. Consider this:
var Child = React.createClass({
render: function() {
<a onClick={this.props.onClick.bind(null, this)}>Click me</a>
}
});
var Parent = React.createClass({
onClick: function(component, event) {
component.props // #=> {Object...}
},
render: function() {
<Child onClick={this.onClick} />
}
});
The key is calling bind(null, this)
on the this.props.onClick
event, passed from the parent. Now, the onClick function accepts arguments component
, AND event
. I think that's the best of all worlds.
This was a bad idea: letting child implementation details leak in to the parent was never a good path. See Sebastien Lorber's answer.