Skip to content

Commit

Permalink
Update ListViews example to use RaRecord type
Browse files Browse the repository at this point in the history
Fixes #7560
  • Loading branch information
hjr3 authored Apr 16, 2022
1 parent 953716c commit 3742c14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ So the `RecordMap` type is no longer necessary and was removed. TypeScript compi

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

const PostListContainer = () => {
- const { data, ids, loading } = useGetList(
Expand All @@ -1400,7 +1400,7 @@ const PostListContainer = () => {
};

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

0 comments on commit 3742c14

Please sign in to comment.