Reputation: 1528
I am trying to read images from folder in reactJS application. I tried with this Solution that is very close to my question on SO but console showing me this error each time.
Here is my code
<img src={require('../images/Mobile/Grab & Go.png')} alt="" />
Console is showing this error
Portfolio.jsx:23 Uncaught ReferenceError: require is not defined
Upvotes: 0
Views: 318
Reputation: 911
You have to import the image then use it as a value passed to the src
prop of img
.
import Image from '../images/Mobile/Grab & Go.png';
...
<img src={Image} alt="" />
Upvotes: 1