Skip to content

Commit 53b709b

Browse files
authored
Fix broken Basic Example
Basic example would return `Cannot read property 'map' of undefined` as not all objects in the tree have children Per issue #8
1 parent 45dc80a commit 53b709b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const tree = {
2525
};
2626

2727
const getChildren = (id) => {
28-
return tree[id].children.map(id => ({ id, height: 30 }));
28+
if (tree[id].children) {
29+
return tree[id].children.map(id => ({ id, height: 30, isSticky: true }));
30+
}
2931
};
3032

3133
const rowRenderer = ({ id, style }) => {

0 commit comments

Comments
 (0)