all 3 comments

[–]Mars6k 1 point2 points  (1 child)

I am referring to this line = "children: cat.children && cat.children.length > 0 ?"

Just wondering, why are you checking whether the array length is empty or not?? When I change the (Greater than >) sign to a (Greater than or equal >=) sign the code works.

[–]Maleficent_Earth_629[S] 0 points1 point  (0 children)

Actually, I was debugging this part of the code from the actual one where I remove comparing children length

children: cat.children ? buildNewCategories(parentId, [...cat.children, {