React.ElementType not working for children
neutraali opened this issue · 1 comments
neutraali commented
( Sorry if the label was wrong! )
Using the following example code:
type Props = {
text: React.ElementType
};
component Component(props: Props) {
return <span>{props.text}</span>;
}
...I'm running into the following error:
Cannot create `span` element because in property `children`: [incompatible-type] Either AbstractComponent [1] is incompatible with `React.Element` [2]. Or AbstractComponent [1] is incompatible with `React.Portal` [3]. Or AbstractComponent [1] is incompatible with `$Iterable` [4]
Am I doing something wrong? I'm kind of having a hard time figuring it out by the docs alone.
gkz commented
You want React.Node
or React.MixedElement