0

I want to use the row selection feature of react-table. I have the table working well, but when i try to use the row selection feature, I keep getting the error. Property 'selectedFlatRows' does not exist on type 'TableInstance'.

  const {
    rows,
    getTableProps,
    getTableBodyProps,
    headerGroups,
    prepareRow,
    selectedFlatRows,
  } = useTable(
    {
      data,
      columns,
    },
    useRowSelect,
    (hooks) => {
      hooks.visibleColumns.push((columns) => [
        {
          id: "selection",
          Header: ({ getToggleAllRowsSelectedProps }: any) => (
            <Group position="center">
              <Checkbox {...getToggleAllRowsSelectedProps()} />
            </Group>
          ),
          Cell: ({ row }: any) => (
            <Group position="center">
              <Checkbox {...row.getToggleRowSelectedProps()} />
            </Group>
          ),
        },
        ...columns,
      ]);
    }
  );

This is the error

This is my tsconfig file

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext", 
    ],
    "types": ["vite/client", "vite-plugin-svgr/client", "vitest/globals"],
    "allowJs": false,
    "skipLibCheck": false,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": ["src"],
  
  // "references": [{ "path": "./tsconfig.node.json" }]
}


Please how do i fix it?

Precious Aang
  • 53
  • 1
  • 4
  • 12

0 Answers0