Skip to content

Commit f2c9bfc

Browse files
committed
Update ReferenceArrayFieldBase example with the updated WithListContext.
1 parent cb47038 commit f2c9bfc

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

docs/ReferenceArrayFieldBase.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,18 @@ A typical `post` record therefore looks like this:
4545
In that case, use `<ReferenceArrayFieldBase>` to display the post tag names as a list of chips, as follows:
4646

4747
```jsx
48-
import { ListBase, ReferenceArrayFieldBase, RecordsIterator } from 'react-admin';
48+
import { ListBase, RecordsIterator, ReferenceArrayFieldBase, WithListContext } from 'react-admin';
4949

5050
export const PostList = () => (
51-
<ListBase
52-
render={({ data, isPending }) => (
53-
<>
54-
{!isPending &&
55-
<RecordsIterator data={data}>
56-
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
57-
<TagList />
58-
</ReferenceArrayFieldBase>
59-
</RecordsIterator>
60-
</>
61-
)}
62-
/>
51+
<ListBase>
52+
<WithListContext loading={null}>
53+
<RecordsIterator>
54+
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
55+
<TagList />
56+
</ReferenceArrayFieldBase>
57+
</RecordsIterator>
58+
</WithListContext>
59+
</ListBase>
6360
);
6461

6562
const TagList = (props: { children: React.ReactNode }) => {

0 commit comments

Comments
 (0)