https://codesandbox.io/s/charming-ives-3jnnn
As per the codesandbox linked, I have a bar chart that counts tracks over a month from 4 different sensors. I followed this tutorial: https://github.com/muratkemaldar/using-react-hooks-with-d3/tree/15-stacked-bar-chart which worked fine. Now I have converted a lot of my code to use mobx, yet I am struggling to get this to work. I left it to use useState but it seems to want to refresh all the time. How do I code the 'onChange' portion?
onChange={(e) => {
if (e.target.checked) {
setKeys(Array.from(new Set([...keys, key])));
} else {
setKeys(keys.filter((_key) => _key !== key));
}