I am trying to require pictures from local path:
{userImages.map((image) => {
return (
<Carousel.Item key={image.id}>
<Card.Img src={require(image.picture)} />
The value inside the variable looks like this:
../../media/female/f1.jpg
The error I am receiving:
Cannot find module '../../media/female/f1.jpg'
I tried another solution to require before the return like this:
const pic = require(userImages[0].picture);
still received the same error. If I user require at the top of the component's file it does require correctly from this path.