From 0308460d896966a9fe5e510926f44bac112923bb Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Jun 2020 15:38:55 +0300 Subject: fix: add unique key prop to polls --- src/Feed/Feed.tsx | 4 ++-- 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 = ({ page }) => { get(endpoint).then(response => { setPolls(response.data); }); - }, []); + }, [endpoint]); return (
- {polls.map(poll => )} + {polls.map(poll => )}
); }; 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; -- cgit v1.2.3