search

Home  >  Q&A  >  body text

javascript - react get image from object

1. React failed to get the image from the object

2. The relevant code is as follows:
for(var index =0;index<newsInfo.length;index ){
let aa = newsInfo[index];
...... .....
..........
..........
<img src={aa.newsImg} width="120 " height="100"/>
}
3. The object has been traversed, the above method is not available, <img src={require(aa.newaImg)}> cannot be loaded, please take a look , give me some opinions

三叔三叔2768 days ago598

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-06-28 09:26:57

    let imgs=newsInfo.map((aa,i)=> <img src={aa.newsImg} width="120" height="100"/>)

    reply
    0
  • Cancelreply