React.memo not working on custom component #342
Unanswered
cdsys-mickey
asked this question in
Q&A
Replies: 1 comment
-
I think I've found the reason for the issue. When comparing props during memo, stopEditing is not equal. However, I've confirmed that in the source code, stopEditing is wrapped with useCallback. I'm not sure if this qualifies as a bug? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello ,
When I use custom components with a large number of rows, the operation becomes very slow when clicking between different rows. So, I placed console.log within these custom components and found that the memo wrapping these components was not effective.
For example, if there are a total of 10 rows, clicking on any cell in the first row won't trigger a re-render, but when clicking on the second row, all components in all 10 rows will be re-render.
Initially, I thought it might be because the methods or properties I passed in were not using memo or useCallback. So, I wrote the method arePropsEqual and found that it was not being called at all. It seems like the grid itself is being redrawn, rendering the memoization of the lower layer completely ineffective. Whether I use DataSheetGrid or DynamicDataSheetGrid, the result is the same.
After searching discussions, I found that nobody has mentioned a similar issue, which leaves me puzzled.
Is this intentional design, or did I do something wrong?
Beta Was this translation helpful? Give feedback.
All reactions