Reputation: 89
I'm trying to load image from file inline cuz I have to pass data (the image name) but nothing works, nor if the image is inside src folder, nor if it's outside in public folder
Here is what I tried last:
<img src={require(`./styles/images/${image}`).default} alt="product img" />
the server returns:
Error: No default engine was specified and no extension was provided.
Upvotes: 1
Views: 233
Reputation: 135
You can use something like this
import logo from './logo.png';
<img src={logo} alt="logo" />
Upvotes: 1