Get started with react-table CDN
MIT licensed
React-table is a popular library for building dynamic, user-interactive tables in React applications.
Tags:- react
- table
- react-table
- datagrid
Stable version
Copied!
How to start using react-table CDN
import React from 'react';
import { useTable } from 'react-table';
const data = [
{
id: 1,
name: 'Sabina',
age: 23,
city: 'New York'
},
{
id: 2,
name: 'Leo',
age: 35,
city: 'San Francisco'
},
{
id: 3,
name: 'Anna',
age: 28,
city: 'Chicago'
}
];
function Table() {
const columns = React.useMemo(
() => [
{
Header: 'Name',
accessor: 'name'
},
{
Header: 'Age',
accessor: 'age'
},
{
Header: 'City',
accessor: 'city'
}
],
[]
);
const {
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow
} = useTable({ columns, data });
return (
<table {...getTableProps()}>
<thead>
{headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map(column => (
<th {...column.getHeaderProps()}>{column.render('Header')}</th>
))}
</tr>
))}
</thead>
<tbody {...getTableBodyProps()}>
{rows.map(row => {
prepareRow(row);
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => (
<td {...cell.getCellProps()}>{cell.render('Cell')}</td>
))}
</tr>
);
})}
</tbody>
</table>
);
}
export default Table;
All versions
0.0.5
1.0.0
1.1.0
1.2.0
1.3.0
2.0.0
2.0.1
2.1.0
2.1.1
2.1.2
2.1.3
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
3.0.0
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.2.0
3.2.1
4.0.0
4.0.1
4.1.0
4.1.1
4.2.0
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
4.3.0
4.4.0
4.4.1
5.0.0
5.0.1
5.0.2
5.0.3
5.0.4
5.1.0
5.1.1
5.2.0
5.3.0
5.3.1
5.3.2
5.3.3
5.3.4
5.3.5
5.4.0
5.4.1
5.5.0
5.5.1
5.5.2
5.5.3
5.6.0
6.0.0
6.0.1
6.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