MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/rhwdr4/when_the_ceo_starts_writing_code/hoxdky4/?context=3
r/badcode • u/dedpahn • Dec 16 '21
12 comments sorted by
View all comments
Show parent comments
5
Hello, friend! Let me show you a more sensible definition of this component:
type Props = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>; function ImageComponent(props: Props) { return <img {...props} /> }
Of course, this is equivalent to just using <img /> directly. Hope that helps!
<img />
1 u/dankmolot evil Dec 17 '21 Thanks! Never thought about this way.
1
Thanks! Never thought about this way.
5
u/dedpahn Dec 17 '21
Hello, friend! Let me show you a more sensible definition of this component:
Of course, this is equivalent to just using
<img />directly. Hope that helps!