react-data-table-component icon indicating copy to clipboard operation
react-data-table-component copied to clipboard

In column placing the components causing tree re-rendering

Open AsjidAle opened this issue 11 months ago • 0 comments

Describe the bug

When we pass buttons as the props in the columns and it cause to tree re-render. But it's illegal practice, do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state. Instead, move this component definition out of the parent component “Categories” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true.

To Reproduce

Steps to reproduce the behavior:

  1. In the columns pass the img or buttons component and pass prop to it
  2. See Error: the Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state. Instead, move this component definition out of the parent component “Categories” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true.

AsjidAle avatar Dec 28 '24 10:12 AsjidAle