Reputation: 55
I'm building a desktop app with React and MySQL, I only store the image name in MySQL and the actual images are in the images folder in /src/images
, When uploading new images to the images folder, the react app reload, So to avoid that from happening
I either need to store the images in MySQL DB
access the images locally not in /src but outside like D:/images/*
.
but react has some importing restrictions.
How can I resolve this issue, please share your knowledge.
Upvotes: 0
Views: 1728
Reputation: 1534
You need to import and use images directly in the component or serve your images as publically available static assets.
You can do this in plenty of ways:
/public/images
directory making them static assets of your pageUpvotes: 2