Im building a grid which consists of Items with ul li structure. Im using the JSON fetched data as a prop for the Class, everything else is fetched but the image. The problem is I cant dynamically fetch my images to the list for the Items from a JSON file. The img files are in a subfolder of the JSON folder. So the path doesn't do anything for me. Every Item has a different image.
[
{
"path": "./imgs/doglogo.svg"
"name": "dog"
},
{
"path": "./imgs/catlogo.svg"
"name": "cat"
}
]
I think I need some sort of required root path parameter but have no idea how to do this?
return (
<li className={'grid-item'}>
<a href={href} className={gridItemLink} key={name}>
<div className={'grid-image'}>
<img src={path} img alt="" />
</div>
</a>
</li>
);