Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nafeu/3e467e2a6f00b16c4b23fb802738ff26 to your computer and use it in GitHub Desktop.
Save nafeu/3e467e2a6f00b16c4b23fb802738ff26 to your computer and use it in GitHub Desktop.
const TableLayout = ({
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow,
}) => {
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, i) => {
prepareRow(row)
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => {
return <td {...cell.getCellProps()}>{cell.render('Cell')}</td>
})}
</tr>
)
})}
</tbody>
</table>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment