Skip to content

Commit

Permalink
refactor: add useCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjeatt committed Jun 27, 2024
1 parent 95a55d1 commit ed9a673
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Tooltip,
useMediaQuery
} from '@gobob/ui';
import { ReactNode } from 'react';
import { ReactNode, useCallback } from 'react';
import { useTheme } from 'styled-components';

import { StyledCategoryTag, StyledIconWrapper, StyledLiveTag, StyledPartnerCard } from './PartnerCard.style';
Expand Down Expand Up @@ -55,7 +55,7 @@ const PartnerCard = ({
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('md'));

const getMedalIcon = () => {
const getMedalIcon = useCallback(() => {
if (!medal) return;

const medalIcon = medal === 'gold' ? <MedalGold /> : medal === 'silver' ? <MedalSilver /> : <MedalBronze />;
Expand All @@ -79,7 +79,7 @@ const PartnerCard = ({
{medalIcon}
</Tooltip>
);
};
}, [isMobile, medal]);

return (
<StyledPartnerCard
Expand Down

0 comments on commit ed9a673

Please sign in to comment.