aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-14 15:38:55 +0300
committereug-vs <eug-vs@keemail.me>2020-06-14 15:38:55 +0300
commit0308460d896966a9fe5e510926f44bac112923bb (patch)
treea77bcec54244156844e245494f1ce434a12fff34
parent3cff0821a8989afca1effb5420d8d0d55d513dbf (diff)
downloadwhich-ui-0308460d896966a9fe5e510926f44bac112923bb.tar.gz
fix: add unique key prop to polls
-rw-r--r--src/Feed/Feed.tsx4
-rw-r--r--src/types.d.ts1
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;