Skip to content

Instantly share code, notes, and snippets.

View Mootikins's full-sized avatar

Matthew Krohn Mootikins

View GitHub Profile
@Mootikins
Mootikins / Magic Data Tables.tsx
Created March 6, 2021 22:58
Decoupling `react-table` tables from their controls
import { usePagination, useSortBy, TableInstancea, Hooks, useTable } from 'react-table';
interface DataTableProps {
columns: { accessor: string; Header: string }[];
data: object[];
hooks: ((hooks: Hooks<object>) => void)[];
children: (props: {
tableInstance: TableInstance<object>;
table: React.ReactNode;
}) => React.ReactElement;