highcharts-react
highcharts-react copied to clipboard
Changing 'constructorType' from 'chart' to 'mapChart' does not work
When changing dynamically 'constructorType' from 'chart' to 'mapChart', the chart is not re-rendered correctly.
A workaround is to add key={constructorType} in
<HighchartsReact
highcharts={Highcharts}
options={chartOptions}
constructorType={constructorType}
key={constructorType}
/>
to force the rerender when the constructorType changes.
A full example is available here: https://stackblitz.com/edit/react-tpdcvy?file=index.js
Try to remove the key={constructorType} and click the button, the map is not rendered.
Hi @eqqe,
Thank you for reporting!
This problem is a bug and needs to be handled in the wrapper code. Your workaround is really good, a fix will work very similar.