document click event listener reactjs code example
Example 1: onclick react
function ActionLink() {
function handleClick(e) { e.preventDefault(); console.log('The link was clicked.'); }
return (
<a href="#" onClick={handleClick}> Click me
</a>
);
}
Example 2: get syntethicbaseevent and parameter in react
Try this:
<button onClick={(e) => clickMe(e, someParameter)}>Click Me!</button>
And in your function:
function clickMe(event, someParameter){
//do with event
}