๐ฅ TypeScript + React Tip ๐ฅ
@jsjoeio40K followers
54,357 views
21 Comments
Comments from the original post on X (Twitter)

@P_FFigueiredo
I was using `React.VFC<Props>` which was basically `React.FC` without the children prop, but since React v18, it doesn't have the children anymore, so, I still think that `React.FC` is a good alternative to type your components in a simple manner. ๐
4 likes

@jsjoeio
might have to redo the video then ๐คฃ does the other downside still apply related to generic props?
1 like

@P_FFigueiredo
Yap, that's a nice one, other than that, I'd say there is another super minor and perhaps opinionated downside for `React.FC/VFC`, which is, they also allow the old ways of defining prop types, meaning: - propTypes - defaultProps And I certainly don't want people using those ๐
1 like

@jsjoeio
Lol ahh okay. Well good to know then it still isn't the best way to type components (I also wouldn't want people to use propTypes or defaultProps)
1 like

@fedevitaledev
Children has been removed from FC since react 18 ๐ฅฒ
1 like

@jsjoeio
๐ ๐ ๐ ๐

@kishore_kch
@tscoursedotcom This one is a cool video, Joe is killing with expressions ๐ ....
1 like

@jsjoeio
@tscoursedotcom haha thanks Kishore! Glad you liked it ๐

@kishore_kch
@tscoursedotcom absolutely Joe ๐ฏ, if it was an YT video the jump from chair reaction would be the ultimate thumbnail ๐
1 like

@jakeymoreland
removed, i believe you can then utilise PropsWithChildren if you wish to then include the broad acceptance of children whilst still using FC
1 like

@jsjoeio
moving this to top of replies ๐ may have to make a follow up video lol
1 like

@rossmci
children was removed from React.FC in React 18, so that's no longer an issue.
1 like

@sujal_shah10
Thanks for this wonderful explaination!
1 like

@jsjoeio
Glad you enjoyed it :D
1 like

@eng_khairallah1
Great tip, Joe!
1 like

@mr_wormhole
mega cursed
1 like

@peterpme
Wow I've been doing this for months out of my lack of desire to look into how to do it correctly ๐

@BalariTheZombie
There are also some helpful utility types like Omit, Exclude, Pick

@incalapabler
I really hate having too many exceptions. How are beginners going to learn when thereโs deprecated code everywhere?

@jsjoeio
@veryfastsimba apparently it was removed in React 18 so this video may be outdated ๐คฃ
1 like
