Skip to content

Commit

Permalink
Fix typos in useReferenceArrayInputContext doc
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Feb 19, 2021
1 parent 35a3b72 commit d5aace6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/Inputs.md
Expand Up @@ -1483,23 +1483,22 @@ In addition to the `ReferenceArrayInputContext`, the `<ReferenceArrayInput>` als

### `useReferenceArrayInputContext`

The [`<ReferenceArrayInput>`](#referencearrayinput) component take care of fetching the data, and put that data in a context called `ReferenceArrayInputContext` so that it’s available for its descendants. This context also stores filters, pagination, sort state, and provides callbacks to update them.
The [`<ReferenceArrayInput>`](#referencearrayinput) component takes care of fetching the data, and put that data in a context called `ReferenceArrayInputContext` so that it’s available for its descendants. This context also stores filters, pagination, sort state, and provides callbacks to update them.

Any component can grab information from the `ReferenceArrayInputContext` using the `useReferenceArrayInputContext` hook. Here is what it returns:

```js
const {
choices, // An array of records mathcing both the current input value and the filters
choices, // An array of records matching both the current input value and the filters
error, // A potential error which may have occured while fetching the data
warning, // A potential warning regarding missing references
loaded, // boolean that is false until the data is available
loading, // boolean that is true on mount, and false once the data was fetched
setFilter, // a callback to update the filters, e.g. setFilters({ q: 'query' })
setPagination, // a callback to change the pagination, e.g. setPagination({ page: 2, perPage: 50 })
setSort, // a callback to change the sort, e.g. setSort({ field: 'name', order: 'DESC' })

setSortForList, // // a callback to set the sort with the same signature as the one from the ListContext. This is required to not break backward compatibility and will be removed in v4.
}
setSortForList, // a callback to set the sort with the same signature as the one from the ListContext. This is required to aboid breaking backward compatibility and will be removed in v4
} = useReferenceArrayInputContext();
```

### `<ReferenceInput>`
Expand Down

0 comments on commit d5aace6

Please sign in to comment.