In React I have created a button, like this:
<Link size="button" onClick={this._handleShareClick.bind(this, this.props.shareID)} href={this.props.URL}>{shareText}</Link>
What I want to do is pass the share ID, but also have access to the regular event object, to allow me to use e.preventDefault();
When I pass to the handler:
_handleShareClick = (e, shareID) => {
console.log(shareID);
e.preventDefault();
}
The shareID doesn't console log, and I also get the following error in my console:
Uncaught TypeError: Cannot read property 'preventDefault' of undefined
Is there a reason I can't access both of these things, or is there another approach that I am missing?
this.props.shareID, so you probably want_handleShareClick = (shareID, e) => ....this.props.shareIDdirectly in_handleShareClick?