1//Event hadling in react
2function ActionLink() {
3 function handleClick(e) {
4 e.preventDefault();
5 console.log('The link was clicked.');
6 }
7
8 return (
9 <a href="#" onClick={handleClick}>
10 Click me
11 </a>
12 );
13}
1Try this:
2
3<button onClick={(e) => clickMe(e, someParameter)}>Click Me!</button>
4
5And in your function:
6
7function clickMe(event, someParameter){
8 //do with event
9}