I think it's a choice/preference. React.PropsWithChildren can be used to mimic the old behavior of React.FC, but sometimes explicitly defining the children prop has been more useful to me, e.g. when you need to force it to be a required property, or slightly modify its type. I think there's good reasons why they decided to remove the implicit children prop from React.FC.
Component that want to get children from type doesnt need to implicitly declare it.
Instead, use:
React.PropsWithChildren<T>Hi, thanks for dropping by.
I think it's a choice/preference.
React.PropsWithChildrencan be used to mimic the old behavior ofReact.FC, but sometimes explicitly defining thechildrenprop has been more useful to me, e.g. when you need to force it to be a required property, or slightly modify its type. I think there's good reasons why they decided to remove the implicitchildrenprop fromReact.FC.Great post! 👏👏
Thanks! Hope it was helpful to you.
Great post!
Keep going sir <3
Thanks! Please look forward to the next article.
Spot on article! I have a cheat sheet similar to this to help me because sometimes I just can't remember how to include children as props :-D
I guess at some point you’ll no longer need that cheat sheet anymore 😛.
Good article, many times I like to use 'React.FC' to declare components, but I'm not sure why
Great article
Nice article ! Just the explanation of ElementType I needed