Skip to content

Commit 148f863

Browse files
committed
[FIX] Unique Key Error with .map
1 parent 0bf6b5c commit 148f863

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

src/assets/content/team.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
"github": "https://github.com/",
2424
"image": "002_jeremy_viau_trudel.jpg",
2525
"highlights": [
26-
"Some hightlight",
27-
"Some hightlight",
28-
"Some hightlight",
29-
"Some hightlight",
30-
"Some hightlight",
31-
"Some hightlight",
3226
"Some hightlight"
3327
]
3428
}

src/components/carousel-card.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { FiLinkedin, FiGithub, FiChevronLeft, FiChevronRight } from 'react-icons
55
import Img from 'gatsby-image';
66
import team from '../assets/content/team.json';
77

8-
9-
108
export default function CarouselCard({pic, index, count, activeIndex, setActiveIndex}) {
119
// handle carousel navigation
1210
const handlePrev = () => {
@@ -47,7 +45,7 @@ export default function CarouselCard({pic, index, count, activeIndex, setActiveI
4745
<ul className="py-4 hidden md:block">
4846
{person.highlights.map(hl => {
4947
return (
50-
<li>
48+
<li key={hl}>
5149
<Trans>{hl}</Trans>
5250
</li>
5351
)
@@ -56,9 +54,9 @@ export default function CarouselCard({pic, index, count, activeIndex, setActiveI
5654
</div>
5755
</div>
5856
<ul className="py-4 block md:hidden">
59-
{person.highlights.map(hl => {
57+
{person.highlights.map((hl, i) => {
6058
return (
61-
<li>
59+
<li key={hl + i}>
6260
<Trans>{hl}</Trans>
6361
</li>
6462
)
@@ -102,7 +100,7 @@ const CarouselCardStyles = styled.div`
102100
color: var(--darkgrey);
103101
}
104102
a svg:hover {
105-
color: var(--red);
103+
color: var(--black);
106104
}
107105
.carousel-btns {
108106
position: absolute;

src/components/carousel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function Carousel() {
2121
...GatsbyImageSharpFluid
2222
}
2323
}
24+
id
2425
}
2526
}
2627
}
@@ -30,7 +31,7 @@ export default function Carousel() {
3031
return (
3132
<>
3233
{pics.map((pic, index) => {
33-
return (<CarouselCard pic={pic} key={pic.node.base} index={index} count={pics.length} activeIndex={activeIndex} setActiveIndex={setActiveIndex}/>)
34+
return (<CarouselCard pic={pic} key={pic.node.id} index={index} count={pics.length} activeIndex={activeIndex} setActiveIndex={setActiveIndex}/>)
3435
})}
3536

3637
</>

src/components/logo-garden.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function LogoGarden() {
4646
fluid(maxWidth: 500, quality: 80) {
4747
...GatsbyImageSharpFluid
4848
}
49+
id
4950
}
5051
}
5152
}
@@ -61,12 +62,12 @@ export default function LogoGarden() {
6162
<Trans>Trusted by these partners and clients</Trans>
6263
</p>
6364
<div className="logos">
64-
{logos.map(({ node }) => (
65+
{logos.map(({node}) => (
6566
<Img
6667
imgStyle={{ width: `auto`, height: `auto`, top: `50%`, left: `50%`, transform: `translate(-50%, -50%)`}}
6768
className="m-4"
6869
fluid={node.childImageSharp.fluid}
69-
key={node.base}
70+
key={node.childImageSharp.id}
7071
alt={node.base.split('.')[0]}
7172
/>
7273
))}

src/components/stacked-avatar.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default function StackedAvatar() {
1717
fixed(width: 200) {
1818
...GatsbyImageSharpFixed
1919
}
20+
id
2021
}
2122
}
2223
}
@@ -35,6 +36,7 @@ export default function StackedAvatar() {
3536
fixed={pic.node.childImageSharp.fixed}
3637
style={{width: `75px`, height: `75px`, zIndex: `${zIndex}`, border: `1px solid var(--white)`, transform: `translateX(${translateX}%)`}}
3738
imgStyle={{objectPosition: `top center`}}
39+
key={pic.node.childImageSharp.id}
3840
/>
3941
)
4042
})}

0 commit comments

Comments
 (0)