We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e407d5 + 09aea4f commit 031a2a6Copy full SHA for 031a2a6
src/components/tree/Tree.js
@@ -17,7 +17,7 @@ class Tree extends React.Component {
17
return (
18
<Root styles={lines}>
19
{tree.map((branch) => {
20
- const nextWithSingleChild = branch.children.length > 1;
+ const nextWithSingleChild = branch?.children?.length > 1;
21
22
<NodeContainer
23
item={branch}
@@ -28,7 +28,7 @@ class Tree extends React.Component {
28
direction={direction}
29
round={multiChild}
30
>
31
- {branch.children.length > 0 && renderTree(branch.children, nextWithSingleChild)}
+ {branch?.children?.length > 0 && renderTree(branch?.children, nextWithSingleChild)}
32
</NodeContainer>
33
);
34
})}
0 commit comments