I am using Highcharts.js in conjunction with React.js. I want to re-render the view when a user clicks a point in Highcharts. To do this, I need to access the props variable in the click handler. Normally, I would just use this.props
to update the props, but this won't work in an event handler. Therefore, how do I access the current component as a variable in the event handler so I can access its props? Is there a better way of doing what I am trying to do?
My config
variable for HighCharts looks something like this. To clarify, this code is coming from the render
function of the same component.
var config = {
...
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function (event) {
//the `this` variable does not have props or state here
//`this` refers to the point object on the graph here
}
}
}
}
},
};
Thanks for your help.