Reputation: 1
I am trying to load an array of images, through their path which i am taking from a rest api but i am taking the error:
Module not found: Can't resolve 'tempString' in 'C:\Users\User\Desktop\React\yiannis\touch\touch\touch\src\pages\en'
and the code is:
{photo.map(image=>(
//tempString = image.replace("../","../../"),
this.setState({tempString : image.replace("../","../../")}),
currentImage = require('tempString')
//Images.push(currentImage)
))}
Any ideas what am i doing wrong?
Upvotes: 0
Views: 51
Reputation: 2361
I think you miss const,you haven't define tempString but to pass date to it.
const tempString = image.replace("../","../../")
And here, what is 'tempString',I think there are some problems here.
require('tempString')
Edit 2:
const Image = []
{photo.map((image) => (
Image.push(image.replace("../","../../"))
)}
Upvotes: 1