Hi I have been trying to pass values to es6 arrow function in my React app, but not successful so far. Here is what I am doing
var data = [];
for (var i=1; i<=5; i++) {
data.push(<li><a href="#" onClick={(e) => this.getData(e, i)} >{i}</a></li>);
}
and code for getData is
getData (e, page){
e.preventDefault();
//here I am calling an api to get data as per page params
}
but actually when the click happens i get nothing. Any help!