image error and load

hi guys i am making a retry function on an image when an error happens, also i want to improve my code and also i am getting a type error in the event on error but that type exists
const CustomImage: Component<CustomImageType> = (props) =>
{
const handleError: JSX.EventHandlerUnion<HTMLImageElement, Event> = (event) =>
{
event.target.src = props.source;
};

return (
<picture class='custom-image'>
<img
src={props.source}
onerror={handleError}
/>
</picture>
);
};

e
const CustomImage: Component<CustomImageType> = (props) =>
{
const handleError: JSX.EventHandlerUnion<HTMLImageElement, Event> = (event) =>
{
event.target.src = props.source;
};

return (
<picture class='custom-image'>
<img
src={props.source}
onerror={handleError}
/>
</picture>
);
};

e
0 Replies
No replies yetBe the first to reply to this messageJoin