Fairly stumped on this and can't seem to get it to work even though I feel I have everything correct.
I have an array that references an image path in my SRC
file and then in my component I want to display that image using an img src
tag but it's just giving me a broken image.
In my array I reference the image here
const actors = [
{
person: 'Luke Skywalker',
trivia: 'wants to go to the Tashi Station',
image: '../../../../static/jt-luke.jpg',
id: 1
},
{
person: 'Leia Organa',
trivia: 'Likes Buns',
image: '../../../../static/jt-leia.jpg',
id: 2
},
{
person: 'Han Solo',
trivia: 'is scruffy',
image: '../../../../static/jt-han.png',
id: 3
},
{
person: 'Chewbacca',
trivia: 'laughs it up like a fuzzball',
image: '/jt-chewie.jpg',
id: 4
}
];
export default actors;
And then in my component I have it setup as so
const { actors } = this.props;
const namesList = actors.map(actors => {
return (
<Col style={{ width: '100%' }} sm={12} md={6} lg={3}>
<UnorderedListed>
<img src={actors.image} />
<p>
{actors.person}
</p>
<p>{actors.trivia}</p>
</UnorderedListed>
</Col>
);
which is returned by calling namesList
<UnorderedStyled>
<Row>
{namesList}
</Row>
</UnorderedStyled>
I don't understand why I'm getting the error, can anyone assist? Thank you!