mirror of
https://github.com/gosticks/react-table.git
synced 2026-07-02 18:40:01 +00:00
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:
committed by
Tanner Linsley
parent
98583d35f3
commit
c8857a2871
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user