From 59fc93868979099950f832e01fe306ff4fc7ce86 Mon Sep 17 00:00:00 2001 From: rezha4 Date: Sun, 16 Nov 2025 12:57:46 +0700 Subject: [PATCH] docs (example/column-resize-performant): checking resize inside UseMemo to avoid unneccessary remounts --- examples/react/column-resizing-performant/src/main.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/react/column-resizing-performant/src/main.tsx b/examples/react/column-resizing-performant/src/main.tsx index 089060f209..f1d31bdd90 100644 --- a/examples/react/column-resizing-performant/src/main.tsx +++ b/examples/react/column-resizing-performant/src/main.tsx @@ -190,7 +190,7 @@ function App() { ))} {/* When resizing any column we will render this special memoized version of our table body */} - {table.getState().columnSizingInfo.isResizingColumn && enableMemo ? ( + {enableMemo ? ( ) : ( @@ -243,9 +243,10 @@ function TableBody({ table }: { table: Table }) { } //special memoized wrapper for our table body that we will use during column resizing -export const MemoizedTableBody = React.memo( - TableBody, - (prev, next) => prev.table.options.data === next.table.options.data +export const MemoizedTableBody = React.memo(TableBody, (prev, next) => + next.table.getState().columnSizingInfo.isResizingColumn + ? prev.table.options.data === next.table.options.data + : false ) as typeof TableBody const rootElement = document.getElementById('root')