Update api.md (#1551)

The state variable seemed to be missing in the useTable part (row 481) and I felt the need to comment on an additional import being needed.
This commit is contained in:
goldenLunchbox
2019-09-27 13:43:13 +02:00
committed by Tanner Linsley
parent 98583d35f3
commit c8857a2871

View File

@@ -475,13 +475,14 @@ The following properties are available on every `Column` object returned by the
```js
function Table({ columns, data }) {
// Set some default sorting state
// Set some default sorting state. For this an additional import of useTableState is needed
const state = useTableState({ sortBy: [{ id: 'firstName', desc: true }] })
const { getTableProps, headerGroups, rows, prepareRow } = useTable(
{
columns,
data,
state,
},
useSortBy // Use the sortBy hook
)