Why is the children
type of Slot
not ReactElement
?
#2222
Unanswered
sungik-choi
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you look at the internal implementation of
Slot
, you'll see that the only time Slot actually works correctly, withisValidElement
checking and so on, is if you use the correctReactElement
.Since it's currently a
ReactNode
type, there are many cases where if it has more than one child or is not aReactElement
, it won't throw an error at compile time and you won't realize it until runtime.Do you know why we used the
ReactNode
type and notReactElement
?Beta Was this translation helpful? Give feedback.
All reactions