aboutsummaryrefslogtreecommitdiff
path: root/src/containers
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-10 13:47:02 +0300
committereug-vs <eug-vs@keemail.me>2020-08-10 13:47:02 +0300
commit78218c0f3427ad79de003ac59cffb99b08f0ae7d (patch)
tree1d5220d68ab8ebb392c87038f2fc24cc72b28775 /src/containers
parent35fcdceb8f04fe333d45c5b1cb7ba395352c92d6 (diff)
downloadwhich-ui-78218c0f3427ad79de003ac59cffb99b08f0ae7d.tar.gz
fix: resolve eslint errors
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/Profile/Profile.tsx21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/containers/Profile/Profile.tsx b/src/containers/Profile/Profile.tsx
index f7678de..7e929fb 100644
--- a/src/containers/Profile/Profile.tsx
+++ b/src/containers/Profile/Profile.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useCallback } from 'react';
+import React, { useEffect, useMemo } from 'react';
import { useHistory, useParams } from 'react-router-dom';
import { Poll } from 'which-types';
import { Container } from '@material-ui/core';
@@ -26,15 +26,12 @@ const Profile: React.FC = () => {
}, [username, history, user]);
- const totalVotes = useCallback(
- polls.reduce(
- (total: number, current: Poll) => {
- const { left, right } = current.contents;
- return total + left.votes + right.votes;
- }, 0
- ),
- [polls]
- );
+ const totalVotes = useMemo(() => polls.reduce(
+ (total: number, current: Poll) => {
+ const { left, right } = current.contents;
+ return total + left.votes + right.votes;
+ }, 0
+ ), [polls]);
return (
<Container maxWidth="sm" disableGutters>
@@ -46,8 +43,8 @@ const Profile: React.FC = () => {
/>
{
isValidating && !polls
- ? <Loading />
- : <PollsList polls={polls} mutate={mutatePolls} />
+ ? <Loading />
+ : <PollsList polls={polls} mutate={mutatePolls} />
}
</Container>
);