DEV Community

Discussion on: TypeScript and React Children

Collapse
 
anidel profile image
Aniello Del Sorbo

FC already accepts children, no need for PropsWithChildren.

If you don't want want children, you can use VFC.

Collapse
 
hellatan profile image
dale tan • Edited

This is no longer true for FC with React 18. You must either use PropsWithChildren or explicitly add a children prop to your type definition.

Thread Thread
 
debs_obrien profile image
Debbie O'Brien

you're right. thanks for the comment.

Collapse
 
kkomelin profile image
Konstantin Komelin

Thank you Aniello! Good to know.

Thread Thread
 
debs_obrien profile image
Debbie O'Brien

thanks guys, will play around with it