react-data-table-component
react-data-table-component copied to clipboard
In column placing the components causing tree re-rendering
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:
- In the columns pass the img or buttons component and pass prop to it
- 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.