lightning:tree Select and add child node dynamically

A lightning:tree component displays the visualization of a structural hierarchy, such as a sitemap for a website or a role hierarchy in an organization. in this example, I will show how to add the child node to the selected node. in this example, the user selects the account and add the child contacts to that account as shown below as shown below. The below image shows the tree before the user add the contacts 

The below image shows the tree after the user adds the contacts. when the user clicks on add contact that will add the contact”test email ” to the selected account.

Apex Class


Lightning Component