diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-14 15:38:55 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-14 15:38:55 +0300 |
commit | 0308460d896966a9fe5e510926f44bac112923bb (patch) | |
tree | a77bcec54244156844e245494f1ce434a12fff34 /src | |
parent | 3cff0821a8989afca1effb5420d8d0d55d513dbf (diff) | |
download | which-ui-0308460d896966a9fe5e510926f44bac112923bb.tar.gz |
fix: add unique key prop to polls
Diffstat (limited to 'src')
-rw-r--r-- | src/Feed/Feed.tsx | 4 | ||||
-rw-r--r-- | src/types.d.ts | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Feed/Feed.tsx b/src/Feed/Feed.tsx index 1b2a81e..d7bfce1 100644 --- a/src/Feed/Feed.tsx +++ b/src/Feed/Feed.tsx @@ -28,11 +28,11 @@ const Feed: React.FC<PropTypes> = ({ page }) => { get(endpoint).then(response => { setPolls(response.data); }); - }, []); + }, [endpoint]); return ( <div className={classes.root}> - {polls.map(poll => <PollCard poll={poll} />)} + {polls.map(poll => <PollCard poll={poll} key={poll._id} />)} </div> ); }; diff --git a/src/types.d.ts b/src/types.d.ts index c9eaec5..31c2c74 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -9,6 +9,7 @@ interface ImageData { } export interface Poll { + _id: string; author: { name: string; avatarUrl: string; |