I have a JSON file that contains an image source. I am trying to display the image, but it doesn't seem to display. I do not get any errors in the console or in the browser.
JSON File:
[
{
"PageLink": "/casestudy/text-healthcare",
"title": "text healthcare website",
"id": "text-healthcare",
"imgSrc": "../assets/work/text-hp.png",
"alt": "text healthcare",
"contentClass": "some text..."
},
{
"PageLink": "/casestudy/text2-healthcare",
"title": "text2 healthcare website",
"id": "text2-healthcare",
"imgSrc": "../assets/work/text2-hp.png",
"alt": "text2 healthcare",
"contentClass": "some text too..."
}
]
Here is where I am calling the JSON data in my JS file where CaseStudyData is how I am importing the JSON data into the JS file:
<FeatureBlock pageLink={CaseStudyData[0].PageLink}
title={CaseStudyData[0].title}
id={CaseStudyData[0].id}
imgSrc={CaseStudyData[0].imgSrc}
alt={CaseStudyData[0].alt}
contentClass={CaseStudyData[0].contentClass} />
<FeatureBlock pageLink={CaseStudyData[1].PageLink}
title={CaseStudyData[1].title}
id={CaseStudyData[1].id}
imgSrc={CaseStudyData[1].imgSrc}
alt={CaseStudyData[1].alt}
contentClass={CaseStudyData[1].contentClass} />
Everything else is loading just fine except the image. It is able to retrieve the data and display it. The path to the image is correct as I have verified already.
Here is the path it displays in console which is the right path but the image is no displaying. It says "http://localhost:3000/assets/work/text-hp.png"