Table cell`s value not updating with useState
Hello everyone. I made a table based on the example from the React. The data for the table comes from useState, which is periodically updated via websocket. In the <td> cell, data is set using the flexRender function:
flexRender(cell.column.columnDef.cell, cell.getContext())
.
There is also a separate columns object in which columns are formed using createColumnHelper: each uses the cell field to generate data, for example:
if I use data => data.getValue()
, then only the very first data is displayed in the table, and updates are not reflected. But if I use this construction instead:
cell: data => data.row.original.symbol
then everything is updated. I looked at the code of the getValue method in the sources - there the data is read from the _valuesCache service field, which does not change when the incoming props are changed. Is this correct behavior or did I make a mistake somewhere?0 Replies