Data is not updating even if the data is mutated
Need to perform sort action outside react table and just the pass the data to react table but i cant able to fine any props or function to trigger that update or to notify react-table to use the latest sorted data
You must immutably update the data object you are passing to react table or at the very least make a new copy of it
I'm using onRowUpdate: (newData, oldData) => Then I'm cloning my react-table data this way: let data = {...myStore}. then, I'm updating data with the newData argument, then I'm dispatching an action to update my store with the new updated data but the table does not re-render with the new data, it stays the same.
Just tried out this way:
let data = myStore.myArray.map((currValue, index)=> {
if(index !== newData.index) return currValue;
return {
...newData
}
});
Does not work either. I thought maybe it was because let data = {... state} is a shallow copy.
Edit Already working properly, both ways worked as expected. I was committing a mistake in the data provided to the table.
Correct. data must be a new object if you want the table to updated. oldData should not === your newData