You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I take children: Children as input for a component, then is there a way to make logic conditional on the number of children?
Naively counting the number of children directly is incorrect because ideally you filter empty string, null, and undefined children? (among others maybe?)
Let's say you filter those out from 1, then what about the () => Child | Children? (btw isn't Child | Children redundant? Why not () => Children?). Do you have to use reactivity somehow to react to the change in the number of children depending on the result of the thunk?
Or is counting the number of children a "bad" thing to do entirely?
The text was updated successfully, but these errors were encountered:
By the way, I could misinterpreting the types, but aren't the Child and Children types identical? Like, they seem to represent the same set of values actually...?
The
Child
/Children
type look like this:If I take
children: Children
as input for a component, then is there a way to make logic conditional on the number of children?Naively counting the number of children directly is incorrect because ideally you filter empty string, null, and undefined children? (among others maybe?)
Let's say you filter those out from 1, then what about the
() => Child | Children
? (btw isn'tChild | Children
redundant? Why not() => Children
?). Do you have to use reactivity somehow to react to the change in the number of children depending on the result of the thunk?Or is counting the number of children a "bad" thing to do entirely?
The text was updated successfully, but these errors were encountered: