fix: add keys on mapped components
This commit is contained in:
@@ -37,7 +37,10 @@ export default function BenefitCard({
|
||||
</div>
|
||||
<div className={styles.benefitComparison}>
|
||||
{comparedValues.map((benefit, idx) => (
|
||||
<div key={idx} className={styles.comparisonItem}>
|
||||
<div
|
||||
key={`${benefit.valueDetails}-${idx}`}
|
||||
className={styles.comparisonItem}
|
||||
>
|
||||
<BenefitValue benefit={benefit} />
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -29,8 +29,9 @@ export default function BenefitList({ levels }: BenefitListProps) {
|
||||
<BenefitCard
|
||||
title={benefit.name}
|
||||
description={benefit.description}
|
||||
comparedValues={levelBenefits.map((benefit) => {
|
||||
comparedValues={levelBenefits.map((benefit, idx) => {
|
||||
return {
|
||||
key: `${benefit.name}-${idx}`,
|
||||
value: benefit.value,
|
||||
unlocked: benefit.unlocked,
|
||||
valueDetails: benefit.valueDetails,
|
||||
|
||||
@@ -14,10 +14,15 @@ export function Blocks({ lang, blocks }: BlocksProps & LangParams) {
|
||||
const firstItem = idx === 0
|
||||
switch (block.__typename) {
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksCardsGrid:
|
||||
return <CardsGrid cards_grid={block.cards_grid} />
|
||||
return (
|
||||
<CardsGrid
|
||||
key={`${block.cards_grid.title}-${idx}`}
|
||||
cards_grid={block.cards_grid}
|
||||
/>
|
||||
)
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
||||
return (
|
||||
<section>
|
||||
<section key={`${block.__typename}-${idx}`}>
|
||||
<JsonToHtml
|
||||
nodes={block.content.content.json.children}
|
||||
embeds={block.content.content.embedded_itemsConnection.edges}
|
||||
@@ -39,6 +44,7 @@ export function Blocks({ lang, blocks }: BlocksProps & LangParams) {
|
||||
<DynamicContentBlock
|
||||
dynamicContent={dynamicContent}
|
||||
firstItem={firstItem}
|
||||
key={`${block.dynamic_content.title}-${idx}`}
|
||||
/>
|
||||
)
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksShortcuts:
|
||||
@@ -49,6 +55,7 @@ export function Blocks({ lang, blocks }: BlocksProps & LangParams) {
|
||||
return (
|
||||
<Shortcuts
|
||||
firstItem={firstItem}
|
||||
key={`${block.shortcuts.title}-${idx}`}
|
||||
shortcuts={shortcuts}
|
||||
title={block.shortcuts.title}
|
||||
subtitle={block.shortcuts.preamble}
|
||||
|
||||
@@ -13,7 +13,7 @@ export function Blocks({ blocks }: BlocksProps) {
|
||||
switch (block.__typename) {
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
||||
return (
|
||||
<section>
|
||||
<section key={`${block.__typename}-${idx}`}>
|
||||
<JsonToHtml
|
||||
nodes={block.content.content.json.children}
|
||||
embeds={block.content.content.embedded_itemsConnection.edges}
|
||||
@@ -25,19 +25,26 @@ export function Blocks({ blocks }: BlocksProps) {
|
||||
<DynamicContentBlock
|
||||
dynamicContent={block.dynamic_content}
|
||||
firstItem={firstItem}
|
||||
key={`${block.dynamic_content.title}-${idx}`}
|
||||
/>
|
||||
)
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksShortcuts:
|
||||
return (
|
||||
<Shortcuts
|
||||
firstItem={firstItem}
|
||||
key={`${block.shortcuts.title}-${idx}`}
|
||||
shortcuts={block.shortcuts.shortcuts}
|
||||
subtitle={block.shortcuts.preamble}
|
||||
title={block.shortcuts.title}
|
||||
/>
|
||||
)
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksCardsGrid:
|
||||
return <CardsGrid cards_grid={block.cards_grid} />
|
||||
return (
|
||||
<CardsGrid
|
||||
cards_grid={block.cards_grid}
|
||||
key={`${block.cards_grid.title}-${idx}`}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user