Skip to content

Commit cfc476c

Browse files
committed
fix: avoid using array index as keys
1 parent dc311d0 commit cfc476c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/cards/challenge/Challenge.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
6666
<Image src={data?.certificateData?.icon} alt="achievement" fill />
6767
</div>
6868
<div className="">
69-
<h1 className="font-bold text-gray-400 text-xs">{t("communities.overview.challenge.unlock.certificate").toUpperCase()}</h1>
70-
{data?.rewards.map((reward, index) => (
71-
<div key={index} className="flex items-center md:gap-1 border-b border-gray-200 py-2">
69+
<h1 className="font-bold text-gray-400 text-xs uppercase">{t("communities.overview.challenge.unlock.certificate")}</h1>
70+
{data?.rewards.map((reward) => (
71+
<div key={reward.id} className="flex items-center md:gap-1 border-b border-gray-200 py-2">
7272
<Coin size="small" token={reward?.token} />
7373
<div className="text-sm">
7474
<span>

src/components/sections/challenges/Rewards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function OverviewRewards(): ReactElement {
3030
<div className="flex flex-col w-full lg:w-1/2">
3131
{challenge?.rewards.map((reward, index, rewardsArray) => (
3232
<div
33-
key={index}
33+
key={reward.id}
3434
className={`flex items-center gap-1 pb-2 ${index !== (rewardsArray.length !== 1 && rewardsArray.length - 1) ? "border-b border-gray-200" : ""} ${
3535
index !== 0 ? "pt-2" : ""
3636
} `}

0 commit comments

Comments
 (0)