I’m using the Repeat for each binding option to create a list of products. From my custom component the only way to achieve it is using the witChildren HOC. Until this point is everything okay as I show in the example below.
const ProductGrid = ({
spacing = 4,
children,
columns = {
mobile: 1,
tablet: 2,
desktop: 3,
},
}) => {
return (
<Flex spacing={spacing} wrap="wrap" direction="row">
{children}
</Flex>
)
}
What I would like to do is to wrap each child of the “Repeat for each” function. But what happens is that the child element is not the actual array of bound elements from “Repeat for each” function but only the single one used to repeat:
return (
<Flex spacing={spacing} wrap="wrap" direction="row">
{Children.map(children, (child) => {
return (
<WrapItem
key={child.key}
w={[1 / columns.mobile, 1 / columns.tablet, 1 / columns.desktop]}
>
{child}
</WrapItem>
)
})}
</Flex>
)
This renders:
<ul>
<li> ... // Builder bound elements list </li>
</ul>
I expect to map the list of repeated elements.