Last active
October 5, 2023 22:26
-
-
Save snigo/1897c90e88fd6b4439fa1680bdffb1fd to your computer and use it in GitHub Desktop.
SOLID React article, code snippet 5: UserAvatar component fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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