-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.tsx
38 lines (34 loc) · 1006 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { UserTable } from "@examples/lib/src/components/UserTable";
import {
useUserData,
userColumns,
} from "@examples/lib/src/components/userData";
import {
getCoreRowModel,
getFilteredRowModel,
getPaginationRowModel,
getSortedRowModel,
useReactTable,
} from "@tanstack/react-table";
import { useRouter } from "next/router";
import { useTableSearchParams } from "tanstack-table-search-params";
export default function Basic() {
const data = useUserData();
const router = useRouter();
const stateAndOnChanges = useTableSearchParams(router);
const table = useReactTable({
data,
columns: userColumns,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getPaginationRowModel: getPaginationRowModel(),
...stateAndOnChanges,
});
return (
<div className="space-y-2 mx-6">
<h1 className="text-lg font-semibold">Basic</h1>
<UserTable table={table} />
</div>
);
}