feat: fixed alt

This commit is contained in:
Nevo David 2024-06-04 00:52:18 +07:00
parent 04838ad145
commit 73b5368707
1 changed files with 13 additions and 12 deletions

View File

@ -10,18 +10,19 @@ interface ImageSrc {
}
const ImageWithFallback: FC<ImageSrc> = (props) => {
const { src, fallbackSrc, ...rest } = props;
const [imgSrc, setImgSrc] = useState(src);
const { src, fallbackSrc, ...rest } = props;
const [imgSrc, setImgSrc] = useState(src);
return (
<Image
{...rest}
src={imgSrc}
onError={() => {
setImgSrc(fallbackSrc);
}}
/>
);
return (
<Image
alt=""
{...rest}
src={imgSrc}
onError={() => {
setImgSrc(fallbackSrc);
}}
/>
);
};
export default ImageWithFallback;
export default ImageWithFallback;