I’m trying to implement Handsontable + react-wrapper but I’m running into issues regarding the most fundamental concepts.
My app is loaded with initial data and can be updated with data coming from both user input as well as external (via sockets) updates from other users.
To achieve this I’m setting initial data via the data prop on HotTable and then updating it using the updateData function. But when the component re-renders the data I add via updateData gets removed but the data from “local changes” remain. From what I can read in the docs this is the recommended way, but I’m hoping I have just missed something.
I managed to get something resembling what I want if I instead skip providing the initial data and just do a loadData on mount. But from docs I read that this would mean that I first get an empty 5x5 grid (because no data passed to HotTable) and THEN I would get my big table with data.
It seems like when the component with HotTable re-renders (not un-mount, see the useEffect with clean-up that does NOT fire). I’ve created a small demo that showcases my confusion. You can see both approaches here: initial data and loading it via loadData, but the one passing initial data clears the data set from updateData when updating the parent state.
Best regards,
Kristoffer Linderman