src/index.js
// To handle th form data and add the folder to the tree.
To handle th form data and add the folder to the tree.
To handle th form data and add the folder to the tree .
handleSubmit(event) {
    event.preventDefault();
    alert("Folder added"); 
    const newFolder = [
      ...this.state.tree,
      { node: this.state.value, pnode: this.state.currentnode }
    ]; 
    this.setState({ tree: newFolder }, () => {
      this.rootFolder();
      this.handleTreetraverse(this.state.currentnode);
    }); 
  }
handleSubmit ( event ) { event . preventDefault ( ) ; alert ( "Folder added" ) ; const newFolder = [ ... this . state . tree , { node : this . state . value , pnode : this . state . currentnode } ] ; this . setState ( { tree : newFolder } , ( ) => { this . rootFolder ( ) ; this . handleTreetraverse ( this . state . currentnode ) ; } ) ; }
To handle th form data and add the folder to the tree.
To handle th form data and add the folder to the tree .
// alert after folder is added // save the folder to the previous tree // call the different functions for re-rendering of the updated components.