In a react App, I would like to store the image path or at least the name of the image file in DB. The image source would be dynamically added.
The below code works:
<img src={require("../Images/amazon.jpg")}></img>
The below code does not work (error:Cannot find module '../Images/amazon.jpg'):
const path = `../Images/amazon.jpg`;
<img src={require( `${path}`)}></img>
How can we set the img src dynamically after fetching image path/name from database.