TypeError: Cannot read properties of undefined (reading 'length') at accessRows
I'm sure that I'm passing table data that is not empty but I still get this error. Does anyone encounter this problem?
I'm using Remix.btw
const categories = [
{
id: "1",
version: 1,
status: SimpleStatus.ACTIVE,
categoryName: "pasta",
branchId: "12",
businessId: "13",
createdAt: new Date(),
createdBy: "Ad",
updatedAt: new Date(),
updatedBy: "Ad",
},
{
id: "2",
version: 1,
status: SimpleStatus.ACTIVE,
categoryName: "pasta",
branchId: "12",
businessId: "13",
createdAt: new Date(),
createdBy: "Ad",
updatedAt: new Date(),
updatedBy: "Ad",
},
] as Category[];
console.log(categories.length); // it logs 2
const table = useReactTable({
categories,
columns,
getCoreRowModel: getCoreRowModel(),
});
TypeError: Cannot read properties of undefined (reading 'length')
at accessRows (file:///.../node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts:31:44)
3 Replies
rival-blackOP•2y ago
Solved my problem by renaming categories to data. I don't know why that works. Anyone care to explain?
fascinating-indigo•2y ago
you have to pass
data
to the table.
is what you need.rival-blackOP•2y ago
Thanks for this.