How to unmount the React components created as part of createdCell callback of a column
How to unmount the React components created as part of createdCell callback of a column
aradhya1982
Posts: 1Questions: 1Answers: 0
This is a generic query. We are using the createCell column definition option to render a react component for each cell.
When we move from one page of the table to another the new react components would be created but the older ones would remain causing the memory of the page to grow.
Is there a pattern through which we can unmount these react components cleanly? Currently, when we try to unmount we are getting the below error.
It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.
Answers
There is no option for this at the moment I'm sorry to say. It is something I plan to look into in the future, but at the moment the content of the cells needs to be controlled by DataTables.
Allan