"Redundant alt attribute. Screen-readers already announce `img` tags as an image." 代码错误

"Redundant alt attribute. Screen-readers already announce `img` tags as an image." Code ERROR

我在我的 React js 文件中输入了 <img src= {'https://robohash.org/${id}?size=300x300'}alt="photo" />, 保存文件后,我在 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

我该如何解决这个问题?

我试过这个并且有效:

<input type="image" img src = {'https://robohash.org/${id}?size=300x300'} alt="photo" />

(url我用了``不是单引号)

'something' 不同于单词 'photo' 和 'image'(或任何指定的自定义单词)。