I've been trying to make a simple chart generator in React. I use Handsontable to let the user enter dynamic data and I would like the changes to be reflected in the chart. Here is my code: Codesandbox reproducible.
Small disclaimer: the handsontable package is pretty buggy in codesandbox. Just double click a number and an inputfield will appear where you can edit data.
The problem
For some reason, you can only edit something from the first data row and the second data row (labels not included). After that, the chart won't update anymore. So try changing 11 under the Mercedes label and you will see what I mean. Those can be changed and the changes will be reflected in the chart, but any number changed after that won't update the chart.
Now I've read this github issue where people suggest to add a random key (key={Math.random()}) or the redraw prop, and that somewhat works, but the whole chart gets redrawn, which is not exactly what I want.