0👍
✅
You dont have access to ‘this’ in the function, so you can bind this or use an arrow function like below
onClick: (evt, item) =>{
this.check("source", this.state.data.datasets[0].data[item[0]._index]);
console.log("test");
},
Also you will have to call this.check and use this.state.data
Source:stackexchange.com