Antd tree table re-render

24 Views Asked by At

Why is it re-rendered when I use expandRowRender? this is my table before expand row this is my table after expand row And my code:

const expandedRowRender = (record: CategoryState) => {
    return (
      <Table
        rowKey={(record) => record._id}
        columns={columns}
        dataSource={record.children}
        expandable={{
          expandedRowRender,
          columnWidth: 30
        }}
        pagination={false}
        showHeader={false}
        size='small'
      />
    )
  }

  return (
    <Table
      size={sm || xs ? 'small' : 'middle'}
      columns={columns}
      expandable={{
        expandedRowRender,
        columnWidth: 30
      }}
      rowKey={(record) => record._id}
      dataSource={cateList}
      pagination={{
        pageSize: data?.data?.limit,
        total: data?.data?.totalDocs,
        onChange: onPageChange,
        position: ['bottomCenter']
      }}
      loading={isLoading}
    />
  )

How to fix the above problem

0

There are 0 best solutions below