[Question] type check JSX children to be a specific component/type

2
closed
neo
neo
Posted 8 months ago

[Question] type check JSX children to be a specific component/type #410

So if I want to define children (or any other prop) to take only a specific component (that I make), is it possible?

An example would be if I have a list component and an item component, and list should only accept an array of the item component...

Thank you!!

sw-yx
sw-yx
Created 8 months ago

not possible, sorry. https://twitter.com/ryanflorence/status/1085745787982700544 let me know if you find otherwise

neo
neo
Created 8 months ago

what a sad conclusion... 😭 thank you for pointing out tho!