Skip to content

Commit

Permalink
Merge pull request #22 from suresh-gangumalla/fix/memoryGame
Browse files Browse the repository at this point in the history
Fix issue with memory game for-loop key
  • Loading branch information
michielvandergeest authored Jun 28, 2024
2 parents 0748ddb + db1ad44 commit 91071ba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/MemoryGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ export default Blits.Component('Announcer', {
<Element>
<Text font="raleway" size="80" color="white" content="Let's play memory!" x="580" y="60" />
<Text font="kalam" size="40" color="#b91c1c" content="the Accessible edition :)" x="1200" y="170" rotation="-6" />
<Element x="260" y="260">
<MemoryCard
:for="(card, index) in $cards"
:col="$index % 4"
:row="Math.floor($index / 4) % 3"
:key="$card.image"
key="$card.id"
image="$card.image"
description="$card.description"
:ref="'card' + $index"
Expand All @@ -76,7 +76,9 @@ export default Blits.Component('Announcer', {
`,
state() {
return {
cards: cards.concat(cards),
cards: cards.concat(cards).map((card, index) => {
return { ...card, id: `card${index}` }
}),
focusedRow: -1,
focusedCol: -1,
openCards: [],
Expand Down

0 comments on commit 91071ba

Please sign in to comment.