code is as follows: why does the whole component (including subcomponents) re-mount when currentItem.isLeaf changes
return React.Children.map([0,1,2,3,4,5,6], (Child, index) => {
const ChildNode = currentItem.isLeaf === "1" ?
AComponent :
BComponent;
return React.createElement(ChildNode,
{
amount: 5,
index,
key: `level-${index}`,
}
)
})