I have read many solutions on stack overflow and blogs but none could solve my problem. I have image urls from api. It is uncommon but it is an assignment to me
productsdata= {
id: 12,
title: "Cat Tee Black T-Shirt",
description: "4 MSL",
availableSizes: ["S", "XS"],
style: "Black with custom print",
price: 10.9,
installments: 9,
currencyId: "USD",
currencyFormat: "$",
isFreeShipping: true,
src_1: "../../assets/113_1.jpg",
src_2: "../../assets/113_2.jpg"
},
here I am displaying image as
{productsdata.map(product => {
return (
<>
<img src={product.src_1} width="200" height="200" alt="tshirt" />
{/* <img src={product.src_2} width="200" height="200" /> */}
</>
);
})}
but it doesn't work as require() only works with static url.
Could someone pls help me?
<img />element.