I'm trying to display the images at I get from an api call. I'm getting:
Uncaught Error: Cannot find module '"https://i.ebayimg.com/thumbs/images/g/gw8AAOSwgsxagkvP/s-l225.jpg"'
Without require, I'm not getting a warning, but nothing is rendering.
console logging the pic variable below displays: "https://i.ebayimg.com/thumbs/images/g/gw8AAOSwgsxagkvP/s-l225.jpg"
I've read that I need to import the pics, but don't know how I should execute that.
class SingleItem extends Component {
constructor(props){
super(props);
}
render(){
const { image: imageUrl } = this.props.value;
let img = Object.values(imageUrl).toString()
let pic = `"${img}"`
var image = require(pic)
return (
<div>
<div src={image}></div>
</div>
)
}
}
export default SingleItem;
divrather than animg. Could that be the problem? Also, you won’t need require for absolute urls.