在basicColumns中报这个错误是因为在Ant Design Table组件的columns配置中使用了columns.customRender属性,而该属性在新版本中已被废弃并且存在性能问题。为了解决这个问题,你需要使用customCell属性替代customRender

customCell属性的用法与customRender类似,它接收一个函数作为参数,该函数用于自定义单元格的渲染。你可以在这个函数中返回一个React节点来自定义单元格的内容。

例如,如果你之前的代码是这样的:

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    customRender: (text, record) => <span>{record.name}</span>,
  },
];

你需要将其修改为:

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    customCell: (text, record) => <span>{record.name}</span>,
  },
];

通过这样的修改,你就可以避免在basicColumns中报columns.customRender属性被废弃的错误了

Warning columnscustomRender return cell props is deprecated with perf issue please use customCell instead为什么在basicColumns里会报这个错

原文地址: https://www.cveoy.top/t/topic/iNHg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录