react.js Replace img src onerror

后端 未结 22 3056
北恋
北恋 2020-11-29 00:20

I have a react component that is the detail view from a list.

I am trying to replace the image with a default image if the image does not exist and there is a 404 er

22条回答
  •  攒了一身酷
    2020-11-29 01:10

    this works for me .

    {{student.firstname}} 
    

    student is the name of my array and noimage the image, when there is no image is display.

提交回复
热议问题