Skip to content

Instantly share code, notes, and snippets.

@snigo
Last active October 5, 2023 22:26
Show Gist options
  • Save snigo/1897c90e88fd6b4439fa1680bdffb1fd to your computer and use it in GitHub Desktop.
Save snigo/1897c90e88fd6b4439fa1680bdffb1fd to your computer and use it in GitHub Desktop.
SOLID React article, code snippet 5: UserAvatar component fix
import Image, { type ImageProps } from 'next/image';
interface AvatarProps extends ImageProps {
imageUrl: string;
altText: string;
}
export const Avatar: React.FunctionComponent<AvatarProps> = ({
imageUrl,
altText,
...props
}) => {
return <Image {...props} src={imageUrl} alt={altText} />;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment