diff --git a/docs/List.md b/docs/List.md index d88dc8b623c..b90796f3e41 100644 --- a/docs/List.md +++ b/docs/List.md @@ -2159,12 +2159,12 @@ const PostList = props => ( export default withStyles(styles)(PostList); ``` -**Tip**: You can use the `Datagrid` component with [custom queries](./Actions.md#usequery-hook): +**Tip**: You can use the `Datagrid` component with [custom queries](./Actions.md#usequery-hook), provided you pass the result to a ``: {% raw %} ```jsx import keyBy from 'lodash/keyBy' -import { useQuery, Datagrid, TextField, Pagination, Loading } from 'react-admin' +import { useQuery, Datagrid, TextField, Pagination, Loading, ListContextProvider } from 'react-admin' const CustomList = () => { const [page, setPage] = useState(1); @@ -2186,16 +2186,19 @@ const CustomList = () => { return

ERROR: {error}

} return ( - <> - id)} - currentSort={{ field: 'id', order: 'ASC' }} - basePath="/posts" // required only if you set use "rowClick" - rowClick="edit" - > + id), + currentSort: { field: 'id', order: 'ASC' }, + selectedIds: [], + }} + > + - + { setPage={setPage} total={total} /> - + + ); ) } ```