Can't keep last active cell in state #194
-
Hi! First of all thank you for this amazing component! I need to make a function to duplicate the entire selected row, but changing some cells values. I don't know if I can do this by overriding duplicateRow function, because I need some extra parameters to check whatever cell I should edit, so I'm trying to store last active cell to get the row and adding a new one to the state by getting the current row through ref.current.activeCell useEffect(() => {
if (ref.current?.activeCell?.row !== data.activeCell?.row) {
setData((data) => ({
...data,
activeCell: ref.current?.activeCell ?? null,
}));
}
}, [ref.current?.activeCell]); But nothing happens, and I don't know what I'm doing wrong :( I tried by setting and interval just like this #139 (comment) and it's working, but I don't want this way because it's slowing everything. Can you help me? Thanks!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello @Aivanaso , If you want something to happen when the active cell changes, use the onActiveCellChangecallback prop. |
Beta Was this translation helpful? Give feedback.
Hello @Aivanaso ,
For performance issues, the parent component is NOT re-rendered when the active cell changes, which is why the
useEffect
does not run.If you want something to happen when the active cell changes, use the onActiveCellChangecallback prop.