I’m having trouble keeping state in sync with React specifically with a simple grid of checkboxes. The data is:
const [dataTypes, setDataTypes] = useState([
{ include: true, overrideExistingData: true },
{ include: true, overrideExistingData: true },
{ include: true, overrideExistingData: true },
]);
I’m trying to update state in the following way:
afterChange={(change, source) => {
if (source === “edit”) {
setDataTypes(dataTypesHotTable.current.hotInstance.getData());
}
}}
However, by logging this to the console, I see that this method is returning the data in the different format pasted below, which the table doesn’t know how to interpret. What would be the cleanest way to resolve this issue?
[
[true, true],
[true, true],
[true, true],
];