How to check for broken images in React JS

后端 未结 5 786
忘了有多久
忘了有多久 2020-12-05 19:25

I\'m writing a module that takes article data from json and shows a large image over the article text, a hero module as they say.

I\'ve got the data and have set it

5条回答
  •  醉酒成梦
    2020-12-05 20:02

    As mentioned, onError is the way to go.

    If you're looking for a component that handles this for you, try https://github.com/socialtables/react-image-fallback

提交回复
热议问题