问题描述
我正在使用反应表 7 来显示数据。数据包含多个嵌套对象。
示例:
incident: {
incidentId: 123,incidentName: "fooBar",incidentDescription: "something bad happened here",actionsTaken:[{
actionId: 89,actionDescription: "We did something here",responseStatusList :[{
responseId:67,reponseType:"written warning",dateIntiated: 04/01/2020
}],}]
}]
}
我可以执行主表(即事件级别)及其子组件(即操作),但是当我尝试为操作执行子组件时,出现错误 React.useCallback" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function
表格代码:
<ReactTable
columns={columns}
data={data}
rowOnClick={true}
headerColor="ddw"
showPagination={true}
rowClickHandler={(e) => console.log("")}
renderRowSubComponent={React.useCallback(
({ row }) =>
row.original.enforcementActionsList.length > 0 ? (
<ReactTable
headerColor="dwq"
data={row.original.enforcementActionsList}
columns={enforcementColumns}
rowOnClick={true}
rowClickHandler={(e) => console.log("")}
renderRowSubComponent={React.useCallback(
({ row }) =>
row.original.responseStatus.length > 0 ? (
<ReactTable
headerColor="dwq"
data={row.original.responseStatus}
columns={statusColumns}
/>
) : (
"No data"
),[]
)}
/>
) : (
"No data"
),[]
)}
如何使用 React-Table 7 在子组件中创建子组件?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)