Skip to content

Commit b9b108c

Browse files
authored
Merge pull request #7563 from hjr3/patch-2
Update ListViews example to use RaRecord type
2 parents 1871806 + 3742c14 commit b9b108c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/Upgrade.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ So the `RecordMap` type is no longer necessary and was removed. TypeScript compi
13801380

13811381
```diff
13821382
-import { useGetList, RecordMap } from 'react-admin';
1383-
+import { useGetList, Record } from 'react-admin';
1383+
+import { useGetList, RaRecord } from 'react-admin';
13841384

13851385
const PostListContainer = () => {
13861386
- const { data, ids, loading } = useGetList(
@@ -1400,7 +1400,7 @@ const PostListContainer = () => {
14001400
};
14011401

14021402
-const PostListDetail = ({ ids, data }: { ids: string[], data: RecordMap }) => {
1403-
+const PostListDetail = ({ data }: { data: Record[] }) => {
1403+
+const PostListDetail = ({ data }: { data: RaRecord[] }) => {
14041404
- return <>{ids.map(id => <span key={id}>{data[id].title}</span>)}</>;
14051405
+ return <>{data.map(record => <span key={record.id}>{record.title}</span>)}</>;
14061406
};

0 commit comments

Comments
 (0)