<Parent>
<ALevel>
<BLevel></BLevel>
</ALevel>
</Parent>
Parent
получить и ALevel
и BLevel
? function getChildren(children) {
let elements = []
if (!children) {
return elements
}
React.Children.forEach(children, child => {
elements = [ ...elements, child, ...getChildren(child.props.children) ]
})
return elements
}