I can successfully pass an argument from an event handler with the code below.
But I wonder, how would I as well pass the event to the function handleDown?
class Parent extends React.Component {
handleDown(argumentOne) {
}
render () {
return (
<div>
<Child
handleDown={this.handleDown.bind(this)}
/>
</div>
);
}
}
class Child extends React.Component {
constructor(props) {
super(props);
}
render () {
return (
<div>
<span
onMouseDown={this.props.handleDown.bind(this, 'argumentOne')}
>
Click here
</span>
</div>
);
}
}
super(props)is unnecessary unless you need access topropsinside of the constructor. Just in case you don't know.