import { ReactNode, useState } from "react"; type Props = { src: string; className: string; children: ReactNode; }; const ImageWithFallback = ({ src, className, children, ...rest }: Props) => { const [error, setError] = useState(false); return error ? ( <>{children} ) : ( { setError(true); }} /> ); }; export default ImageWithFallback;