I am creating a I’ve tried so many different ways with the image, but I just can’t seem to figure it out…
I hope someone Quiz App in React Native and have a problem when inserting images with each question on a js data file.
I am also a beginner with React Native, so 🙏 !!!!
This is my .js file:
export default data = [
{
question1: "How would you say 'Cherry' in Italian?,
image: require('../../assets/images/cartoon cherry.png),
options: ["Mela", "Fragola", "Ciliegia"],
correct_option: "Ciliegia"
},
]
I’ve tried so many different ways with the image, but I just can’t seem to figure it out…
I hope someone will give me a hand here… thanx..
2
Answers
There’s a minor syntax error in your JavaScript data file. The require statement for the image should be a valid JavaScript expression, and your question1 string is missing a closing quote (‘).
Please refer corrected code:
Hope this helps you out 🙂
If this not work for you, then check the path of your image.