Reputation: 44436
In my memory, you could write this:
const SomeComponent:FC<{label: string}> = ({label, children}) => (
and I even found some documentation claiming you can do it. When I try (with React version 18.2), I just get an error saying children
is not a prop.
When I do this
const SomeComponent:FC<PropsWithChildren<{label: string}>> = ({label, children}) => (
it works fine, but that’s wordy. Did this used to work and they changed it and nobody told me? Why did they change it? And why did nobody tell me?
Upvotes: 3
Views: 2439