Replies: 1 comment 1 reply
-
|
Creating components inside components (nested components) will cause React to throw away the state of those nested components on each re-render of their parent. You are creating the You can use some memoisation ( For such cases, there is a react/no-unstable-nested-components rule for ESLint, which provides a more detailed description with reasons and examples. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created my own data-table.tsx component that uses shadcn's and tanstack's table components. The table works fine, up until I discovered a very strange and infuriating bug, which is, when I write a value inside of a cell component and i refocus the window, the whole component re-renders for no known reason. I have tried to replace the custom input with a simple input, without any other events besides onChange, but no luck.
I have no idea what is causing this re-render but any help is greatly appreciated.
Below are the components at fault:
-- data-table.tsx
Columns.tsx
ProductInput.tsx
Beta Was this translation helpful? Give feedback.
All reactions