-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.tsx
More file actions
40 lines (36 loc) · 1.04 KB
/
index.tsx
File metadata and controls
40 lines (36 loc) · 1.04 KB
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
39
40
import { UserTable } from "@examples/lib/src/components/UserTable";
import {
userColumns,
useUserData,
} 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, {
enabled: { globalFilter: false, sorting: false },
});
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>
);
}