@@ -29,7 +29,7 @@ class Tree {
2929 * @param state : the tree's current state
3030 * @param name : the tree's name
3131 * @param componentData : Data in the component tree
32- * @param parent generates a new tree (recursive call)
32+ * @parent generates a new tree (recursive call)
3333 */
3434 state : string | { } ;
3535
@@ -68,7 +68,7 @@ class Tree {
6868 cleanTreeCopy ( ) : Tree {
6969 /**
7070 * @object circularComponentTable : Clears circular component table only on first call, not recursive ones
71- * @method clear clears component table
71+ *
7272 */
7373 //
7474 if ( copyInstances === 0 ) {
@@ -97,6 +97,26 @@ class Tree {
9797 copyInstances -- ;
9898 return copy ;
9999 }
100+
101+ // print out the tree structure in the console
102+ // DEV: Process may be different for useState components
103+ // BUG FIX: Don't print the Router as a component
104+ // Change how the children are printed
105+ // print() {
106+ // const children = ['children: '];
107+ // // DEV: What should we push instead for components using hooks (it wouldn't be state)
108+ // // if this.children is always initialized to empty array, when would there ever be anything to iterate through here?
109+ // this.children.forEach((child: any) => {
110+ // children.push(child.state || child.component.state);
111+ // });
112+ // if (this.name) console.log('this.name if exists: ', this.name);
113+ // if (children.length === 1) {
114+ // console.log(`children length 1. ${this.state ? 'this.state: ' : 'this.component.state: '}`, this.state || this.component.state);
115+ // } else console.log(`children length !== 1. ${this.state ? 'this.state: ' : 'this.component.state, children: '}`, this.state || this.component.state, ...children);
116+ // this.children.forEach((child: any) => {
117+ // child.print();
118+ // });
119+ // }
100120}
101121
102122export default Tree ;
0 commit comments