You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/useList.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ title: "useList"
7
7
8
8
The `useList` hook allows to create a `ListContext` based on local data. `useList` creates callbacks for sorting, paginating, filtering, and selecting records from an array.
9
9
10
-
Thanks to it, you can display your data inside a [`<Datagrid>`](./Datagrid.md), a [`<SimpleList>`](./SimpleList.md) or an [`<EditableDatagrid>`](./EditableDatagrid.md).
10
+
Thanks to it, you can display your data inside a [`<Datagrid>`](./Datagrid.md), a [`<SimpleList>`](./SimpleList.md) or an [`<EditableDatagrid>`](./EditableDatagrid.md).
11
11
12
12
## Usage
13
13
@@ -31,7 +31,7 @@ const MyComponent = () => {
31
31
constlistContext=useList({ data });
32
32
return (
33
33
<ListContextProvider value={listContext}>
34
-
<Datagrid>
34
+
<Datagrid resource="actors">
35
35
<TextField source="id"/>
36
36
<TextField source="name"/>
37
37
</Datagrid>
@@ -53,14 +53,15 @@ const MyComponent = () => {
53
53
constlistContext=useList({ data, isPending });
54
54
return (
55
55
<ListContextProvider value={listContext}>
56
-
<Datagrid>
56
+
<Datagrid resource="posts">
57
57
<TextField source="id"/>
58
58
<TextField source="name"/>
59
59
</Datagrid>
60
60
</ListContextProvider>
61
61
);
62
62
};
63
63
```
64
+
64
65
## Parameters
65
66
66
67
`useList` expects an object with the following keys:
@@ -69,7 +70,7 @@ const MyComponent = () => {
69
70
*[`filter`](#filter)
70
71
*[`filterCallback`](#filtercallback)
71
72
*[`isFetching`](#isfetching)
72
-
*[`isPending`](#isPending)
73
+
*[`isPending`](#ispending)
73
74
*[`page`](#page)
74
75
*[`perPage`](#perpage)
75
76
*[`sort`](#sort)
@@ -153,7 +154,7 @@ const MyComponent = () => {
153
154
constlistContext=useList({ data, isFetching });
154
155
return (
155
156
<ListContextProvider value={listContext}>
156
-
<Datagrid>
157
+
<Datagrid resource="posts">
157
158
<TextField source="id"/>
158
159
<TextField source="name"/>
159
160
</Datagrid>
@@ -183,7 +184,7 @@ const MyComponent = () => {
183
184
constlistContext=useList({ data, isPending });
184
185
return (
185
186
<ListContextProvider value={listContext}>
186
-
<Datagrid>
187
+
<Datagrid resource="posts">
187
188
<TextField source="id"/>
188
189
<TextField source="name"/>
189
190
</Datagrid>
@@ -256,7 +257,7 @@ const { data } = useList({
256
257
257
258
## Return Value
258
259
259
-
`useList` returns an object with keys matching the shape of the `ListContext`:
260
+
`useList` returns an object with keys matching the shape of the `ListContext`:
0 commit comments