I have buttons created in a loop. Each contains a key and data-id property.
I want to onClick pass the key or data-id to the called function.
I experimented a few things, but none worked.
Here is the code.
buttonPress: function (path,type,period) {
AppActions.moveToPage(path,{type:type},period);
},
<div key={$key} data-id={$key} style={{textAlign: 'center'}} onClick={() => this.buttonPress("Listing",this.props.id, this.state.filters)}>{this.state.Graph?this.state.diagnosisGraph[key]:<img src={AppApi.baseUrl + 'img/loading.gif'} />}</div>