Because with Repeat we don't have access to item itself. All item based rendering always have to be inside a component and external children of the component must not rely on the item.
Right, right sorry. I should have though that through :)
Yeah you can't do that, unless you use a version which takes a function as a child, but then if it's this case... well I'd just probably do the items.map as you point out. My project's version does have support for a function child but really the semantics are then using {} so I don't bother and just use the map.
The real point was when you need to do a sub component because you need hooks in the wrapper. I'd prefer this laid out in the template version (because frequently in our code base we'd swap from <Repeat> to <VirtualRepeat> which has the same signature, but virtualises the elements.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
About children I just mean, that it is not possible to do something like this:
Because with
Repeat
we don't have access to item itself. Allitem
based rendering always have to be inside a component and external children of the component must not rely on theitem
.In some cases we just don't need a component
Right, right sorry. I should have though that through :)
Yeah you can't do that, unless you use a version which takes a function as a child, but then if it's this case... well I'd just probably do the
items.map
as you point out. My project's version does have support for a function child but really the semantics are then using{
}
so I don't bother and just use themap
.The real point was when you need to do a sub component because you need hooks in the wrapper. I'd prefer this laid out in the template version (because frequently in our code base we'd swap from
<Repeat>
to<VirtualRepeat>
which has the same signature, but virtualises the elements.