MCPcopy
hub / github.com/TanStack/table / App

Function App

examples/react/filters/src/main.tsx:28–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function App() {
29 const rerender = React.useReducer(() => ({}), {})[1]
30
31 const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
32 []
33 )
34
35 const columns = React.useMemo<ColumnDef<Person, any>[]>(
36 () => [
37 {
38 accessorKey: 'firstName',
39 cell: info => info.getValue(),
40 },
41 {
42 accessorFn: row => row.lastName,
43 id: 'lastName',
44 cell: info => info.getValue(),
45 header: () => <span>Last Name</span>,
46 },
47 {
48 accessorFn: row => `${row.firstName} ${row.lastName}`,
49 id: 'fullName',
50 header: 'Full Name',
51 cell: info => info.getValue(),
52 },
53 {
54 accessorKey: 'age',
55 header: () => 'Age',
56 meta: {
57 filterVariant: 'range',
58 },
59 },
60 {
61 accessorKey: 'visits',
62 header: () => <span>Visits</span>,
63 meta: {
64 filterVariant: 'range',
65 },
66 },
67 {
68 accessorKey: 'status',
69 header: 'Status',
70 meta: {
71 filterVariant: 'select',
72 },
73 },
74 {
75 accessorKey: 'progress',
76 header: 'Profile Progress',
77 meta: {
78 filterVariant: 'range',
79 },
80 },
81 ],
82 []
83 )
84
85 const [data, setData] = React.useState<Person[]>(() => makeData(5_000))

Callers

nothing calls this directly

Calls 12

makeDataFunction · 0.90
useReactTableFunction · 0.90
flexRenderFunction · 0.90
getCoreRowModelFunction · 0.85
getFilteredRowModelFunction · 0.85
getSortedRowModelFunction · 0.85
getPaginationRowModelFunction · 0.85
getContextMethod · 0.80
previousPageMethod · 0.80
nextPageMethod · 0.80
refreshDataFunction · 0.70
rerenderFunction · 0.50

Tested by

no test coverage detected