I want to call react function on click event of react apex chart. While cliking on apex chart bar or pie chart slice , i want to call react function example:-
dataPointSelection: function (event, chartContext, config) {
this.myFunction();
}
I can't call myFunction() from here
There is simple way to do this:-
dataPointSelection: (event, chartContext, config) => {
this.myFunction();
}
I was missing => to call function Actually you have to call react methods from an arrow function, as this is currently pointing to the chart instance and not the react instance.