Hide broken image link in Semantic UI React
You can pass the img
element to an onError
handler through the handler event's target
property, and change the image's src
to ''
or style.display
to none
.
<Image src={imageObject.Url} onError={i => i.target.src=''} />
<Image src={imageObject.Url} onError={i => i.target.style.display='none'} />
You can use:
<Image src={imageObject.Url} onError={e => e.target.style.display = 'none'} />