Lightning web components are built using HTML and modern JavaScript and can coexist and interoperate on a page with the Aura components. They use core Web Components standards and as they are built to run natively in the browsers, they are lightweight and deliver exceptional performance.
The key to understanding the workings of the Salesforce Lightning Web Components is to learn how they communicate with each other. Communication is critical to write powerful, flexible, and dynamic Lightning Web Components. Moreover, their communication pattern varies from Auro components and that is why they deliver exceptional performance.
For Live Demo Click Here
So, without further ado, let’s understand how you can call a child Lightning Web Component from the parent Lightning Web Component.
Code
Parent Lightning Component Code
Child LWC Code:
Javascript Code:
Javascript-meta.xml:
Conclusion:
As said above, the communication between the Lightning Web Components is different from the Aura components. It is because the bidirectional data binding doesn’t exist anymore, so you need to pass the data through the events, enhancing the Lightning Web Components’ performance exceptionally.
So try this code out and share your experiences with us. Happy Learning!🙂