Posts

Showing posts from August, 2020

EVENTS IN Lightning Web Components

Events in Lightning web components (LWC) | Communicate with Events In this post we will talk about how to use the lightning web component events to communicate between components. Events in Lightning web components are built on DOM Events, a collection of APIs and objects available in every browser. Here we will be see how to the events using the CustomEvent interface and publish-subscribe utility. COMPONENT COMMUNICATION THROUGH EVENTS There are typically 3 approaches for communication between the components using events. Communication using Method in LWC ( Parent to Child ) Custom Event Communication in Lightning Web Component (Child to Parent ) Publish Subscriber model in Lightning Web Component ( Two components which doesn't have a direct relation )  1) COMMUNICATION USING METHOD IN LWC (PARENT TO CHILD) In Aura framework, we can call the method of Child Component from the Parent Component with the help of <aura:method> . In LWC also we can do the same. In LWC Aura Method