I'm using highcharts in React , and I want to invoke .get() method. the official demo is like :
var chart = $('#container').highcharts(),
locationA = chart.get('locationA'),
locationB = chart.get('locationB'),
locationC = chart.get('locationC'),
locationD = chart.get('locationD');
and I want to get chat in React , so I also use highcharts-react lib , I create a ref like this :
constructor(props) {
super(props);
this.chartComponent = React.createRef();
}
render() {
console.dir(usaBubbleData);
return (
<div className='container'>
<HighchartsReact
highcharts={Highcharts}
constructorType={"mapChart"}
options={maplineOptions}
ref={this.chartComponent}
/>
</div>
);
}
componentDidMount() {
var locationA = this.chartComponent.get("locationA"),
}
and I got an error :
× TypeError: this.chartComponent.get is not a function
I don't know are the same instance with the ref in React and var chart = $('.container').highcharts()
?
can any one tell me what's wrong with it?