我输入了 <img src= {'https://robohash.org/${id}?size=300x300'}alt="photo" />
在我的 React js 文件上,
保存文件后,我在 GitBash 上收到一条错误消息,说,
Redundant alt attribute. Screen-readers already announce 'img' tags as an image. You don’t need to use the words 'image', 'photo,' or 'picture' (or any specified custom words) in the alt prop jsx-a11y/img-redundant-alt
然后我删除了 alt
从代码中,我收到错误消息,
img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
我该如何解决这个问题?
最佳答案
不同于单词“照片”和“图像”(或任何指定的自定义单词)的“东西”。
关于reactjs - "Redundant alt attribute. Screen-readers already announce ` img ` tags as an image."代码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67448468/