MCPcopy Index your code
hub / github.com/TanStack/table / App

Function App

examples/react/filters-faceted/src/main.tsx:31–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

makeDataFunction · 0.90
useReactTableFunction · 0.90
flexRenderFunction · 0.90
getCoreRowModelFunction · 0.85
getFilteredRowModelFunction · 0.85
getSortedRowModelFunction · 0.85
getPaginationRowModelFunction · 0.85
getFacetedRowModelFunction · 0.85
getFacetedUniqueValuesFunction · 0.85
getFacetedMinMaxValuesFunction · 0.85
getContextMethod · 0.80
previousPageMethod · 0.80

Tested by

no test coverage detected