Unable to add image variable in return function

I’m currently working on a project for a social media type website, I have a multer which saves the images in to project/server/images and the name of the image is sent amongst other data to mySQL. In my home page js file stored in project/client/src/pages I want to be able to access the images and import them using a variable. The issue is firstly that using return function for example
<img src="./image.png" />
doesn’t work… it needs to be in the format
<img src={image} />
with an image import in the js file.
I’m not sure how I can create a return function that will allow me to simply insert the name of the file which I can retrieve from my SQL database to the end of a path to show the image correctly… Any ideas are welcomed and much appreciated! I hope that it’s clear enough!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.