77 tableFeatures ,
88 useTable ,
99} from '@tanstack/react-table'
10- import type { ColumnDef } from '@tanstack/react-table'
1110
1211type Person = {
1312 firstName : string
@@ -49,11 +48,11 @@ const _features = tableFeatures({})
4948
5049const columnHelper = createColumnHelper < typeof _features , Person > ( )
5150
52- const columns = [
51+ const columns = columnHelper . columns ( [
5352 columnHelper . group ( {
5453 id : 'hello' ,
5554 header : ( ) => < span > Hello</ span > ,
56- columns : [
55+ columns : columnHelper . columns ( [
5756 columnHelper . accessor ( 'firstName' , {
5857 cell : ( info ) => info . getValue ( ) ,
5958 footer : ( props ) => props . column . id ,
@@ -64,19 +63,19 @@ const columns = [
6463 header : ( ) => < span > Last Name</ span > ,
6564 footer : ( props ) => props . column . id ,
6665 } ) ,
67- ] as Array < ColumnDef < typeof _features , Person > > ,
66+ ] ) ,
6867 } ) ,
6968 columnHelper . group ( {
7069 header : 'Info' ,
7170 footer : ( props ) => props . column . id ,
72- columns : [
71+ columns : columnHelper . columns ( [
7372 columnHelper . accessor ( 'age' , {
7473 header : ( ) => 'Age' ,
7574 footer : ( props ) => props . column . id ,
7675 } ) ,
7776 columnHelper . group ( {
7877 header : 'More Info' ,
79- columns : [
78+ columns : columnHelper . columns ( [
8079 columnHelper . accessor ( 'visits' , {
8180 header : ( ) => < span > Visits</ span > ,
8281 footer : ( props ) => props . column . id ,
@@ -89,11 +88,11 @@ const columns = [
8988 header : 'Profile Progress' ,
9089 footer : ( props ) => props . column . id ,
9190 } ) ,
92- ] as Array < ColumnDef < typeof _features , Person > > ,
91+ ] ) ,
9392 } ) ,
94- ] as Array < ColumnDef < typeof _features , Person > > ,
93+ ] ) ,
9594 } ) ,
96- ]
95+ ] )
9796
9897function App ( ) {
9998 const [ data , _setData ] = React . useState ( ( ) => [ ...defaultData ] )
@@ -128,7 +127,7 @@ function App() {
128127 < tbody >
129128 { table . getRowModel ( ) . rows . map ( ( row ) => (
130129 < tr key = { row . id } >
131- { row . getVisibleCells ( ) . map ( ( cell ) => (
130+ { row . getAllCells ( ) . map ( ( cell ) => (
132131 < td key = { cell . id } >
133132 { flexRender ( cell . column . columnDef . cell , cell . getContext ( ) ) }
134133 </ td >
0 commit comments