diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-29 22:03:52 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-29 22:03:52 +0300 |
commit | aed13f230d2673a489aec455e48d6edbb503e001 (patch) | |
tree | 9968e6fd2ac00f471ef97af3764b4fa0af493d13 /src/pages/FeedPage/FeedPage.tsx | |
parent | c68b0e0c3ad72a48ba421dbbc9b70d177f8ecbfc (diff) | |
download | which-ui-aed13f230d2673a489aec455e48d6edbb503e001.tar.gz |
refactor: improve poll addition
Diffstat (limited to 'src/pages/FeedPage/FeedPage.tsx')
-rw-r--r-- | src/pages/FeedPage/FeedPage.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pages/FeedPage/FeedPage.tsx b/src/pages/FeedPage/FeedPage.tsx index 329647e..0017275 100644 --- a/src/pages/FeedPage/FeedPage.tsx +++ b/src/pages/FeedPage/FeedPage.tsx @@ -20,9 +20,15 @@ const FeedPage: React.FC<PropTypes> = ({ navigate, user }) => { }); }, []); + const addPoll = (poll: Poll): void => { + polls.unshift(poll); + setPolls([...polls]); + }; + + return ( <> - {user && <PollSubmission user={user} polls={polls} setPolls={setPolls} />} + {user && <PollSubmission user={user} addPoll={addPoll} />} <Feed polls={polls} navigate={navigate} /> </> ); |