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

Function App

examples/react/pagination/src/main.tsx:21–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19import { makeData, Person } from './makeData'
20
21function App() {
22 const rerender = React.useReducer(() => ({}), {})[1]
23
24 const columns = React.useMemo<ColumnDef<Person>[]>(
25 () => [
26 {
27 accessorKey: 'firstName',
28 cell: (info) => info.getValue(),
29 footer: (props) => props.column.id,
30 },
31 {
32 accessorFn: (row) => row.lastName,
33 id: 'lastName',
34 cell: (info) => info.getValue(),
35 header: () => <span>Last Name</span>,
36 footer: (props) => props.column.id,
37 },
38 {
39 accessorKey: 'age',
40 header: () => 'Age',
41 footer: (props) => props.column.id,
42 },
43 {
44 accessorKey: 'visits',
45 header: () => <span>Visits</span>,
46 footer: (props) => props.column.id,
47 },
48 {
49 accessorKey: 'status',
50 header: 'Status',
51 footer: (props) => props.column.id,
52 },
53 {
54 accessorKey: 'progress',
55 header: 'Profile Progress',
56 footer: (props) => props.column.id,
57 },
58 ],
59 [],
60 )
61
62 const [data, setData] = React.useState(() => makeData(100000))
63 const refreshData = () => setData(() => makeData(100000))
64
65 return (
66 <>
67 <MyTable
68 {...{
69 data,
70 columns,
71 }}
72 />
73 <hr />
74 <div>
75 <button onClick={() => rerender()}>Force Rerender</button>
76 </div>
77 <div>
78 <button onClick={() => refreshData()}>Refresh Data</button>

Callers

nothing calls this directly

Calls 3

makeDataFunction · 0.90
refreshDataFunction · 0.70
rerenderFunction · 0.50

Tested by

no test coverage detected