Skip to content Skip to sidebar Skip to footer

Not Loading Images On React Using A Json Object As Reference

this is my problem I have this object Json below: const imagesData = [ { 'imagepath': './images/a.jpg', 'title': 'Red Car', 'uploadeDate': '2 May 2020',

Solution 1:

I think you should keep your images folder in the public Folder and then you can try this directly without importing.

const imagesData = [
    {
        "imagepath": '/images/a.jpg',
        "title": "Red Car",
        "uploadeDate": "2 May 2020",
        "index": "0"
    }, {
        "imagepath": '/images/b.jpg',
        "title": "Blue Car",
        "uploadeDate": "2 May 2020",
        "index": "1"
    }, {
        "imagepath": '/images/c.jpg',
        "title": "Green Car",
        "uploadeDate": "2 May 2020",
        "index": "2"
    }

]

Post a Comment for "Not Loading Images On React Using A Json Object As Reference"