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
`<RecordsIterator>` expects that data is properly loaded, without error. If you want to handle loading, error, offline and empty states, use properties on the component providing you the list context (like [`<List>`](./List.md), [`<ReferenceArrayField>`](./ReferenceArrayField.md), [`<ReferenceManyField>`](./ReferenceManyField.md)). You can also make use of [`<WithListContext>`](./WithListContext.md)[`loading`](./WithListContext.md#loading), [`errorElement`](./WithListContext.md#errorelement), [`offline`](./WithListContext.md#offline) and [`empty`](./WithListContext.md#empty) props.
46
+
`<RecordsIterator>` expects that data is properly loaded, without error. If you want to handle loading, error, offline and empty states, use related props on the component providing you the list context (like [`<List loading>`](./List.md), [`<ReferenceArrayField loading>`](./ReferenceArrayField.md), [`<ReferenceManyField loading>`](./ReferenceManyField.md)). You can also make use of [`<WithListContext>`](./WithListContext.md)[`loading`](./WithListContext.md#loading), [`error`](./WithListContext.md#error), [`offline`](./WithListContext.md#offline) and [`empty`](./WithListContext.md#empty) props.
|`children`| Optional`*`|`ReactNode`| - | The content to render for each record |
76
+
|`data`| Optional`*`|`RaRecord[]`| - | The records. Defaults to the `data` from the [`ListContext`](./useListContext.md)|
77
+
|`isPending`| Optional |`boolean`| - | A boolean indicating whether the data is pending. Defaults to the `isPending` from the [`ListContext`](./useListContext.md)|
78
+
|`render`| Optional |`(record: RaRecord) => ReactNode`| - | A function that returns the content to render for each record |
79
+
|`total`| Optional |`number`| - | The total number of records. Defaults to the `total` from the [`ListContext`](./useListContext.md)|
|`children`| Optional |`ReactNode`| - | The content to render for each record |
79
-
|`data`| Optional |`RaRecord[]`| - | The records. Defaults to the `data` from the [`ListContext`](./useListContext.md)|
80
-
|`isPending`| Optional |`boolean`| - | A boolean indicating whether the data is pending. Defaults to the `isPending` from the [`ListContext`](./useListContext.md)|
81
-
|`render`| Optional |`(record: RaRecord) => ReactNode`| - | A function that returns the content to render for each record |
82
-
|`total`| Optional |`number`| - | The total number of records. Defaults to the `total` from the [`ListContext`](./useListContext.md)|
If provided, `RecordsIterator` will call the `render` prop for each record. This is useful when the components you render need the record data to render themselves, or when you want to pass additional props to the rendered component.
166
+
If provided, `RecordsIterator` will call the `render` prop for each record. This is useful to customize the rendered component using the record data.
170
167
171
168
{% raw %}
172
169
```tsx
@@ -185,27 +182,3 @@ const PostList = () => (
185
182
{% endraw %}
186
183
187
184
**Note**: You can't provide both the `children` and the `render` props. If both are provided, `<RecordsIterator>` will use the `render` prop.
188
-
189
-
## `total`
190
-
191
-
Although `<RecordsIterator>` reads the total from the closest [`<ListContext>`](./useListContext), you may provide it yourself when no such context is available:
Copy file name to clipboardExpand all lines: docs/ReferenceManyFieldBase.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,17 +72,20 @@ const BookList = ({
72
72
You can also use `<ReferenceManyFieldBase>` in a list, e.g. to display the authors of the comments related to each post in a list by matching `post.id` to `comment.post_id`:
Another use case is to create a button that refreshes the current list. As the [`ListContext`](./useListContext.md) exposes the `refetch` function, it's as simple as:
0 commit comments