Reputation: 210
I'm new to react & I'm trying to add a local image to my react app. This is what i've currently, <Image source={require("images/pic.jpeg")} />
but cant figure out why am i getting this error.
ERROR 00:24 Unable to resolve "images/pic.jpeg" from "App.js"
I've installed the Image component also, and have made a separate images folder. I'm using iOS simulator.
If someone could help me regarding this, it would be great! Thanks in advance!
Upvotes: 0
Views: 1323
Reputation: 543
<Image source={require('./images/pic.jpeg')} />
Please pass the pass which you have in your folder structure
and require path would be like above example, with ./
or ../
import picImage from '../../assets/images/pic.jpeg';
and pass this picImage as src value
<Image source={picImage} />
Upvotes: 1