Showing posts with label Events in LWC. Show all posts
Showing posts with label Events in LWC. Show all posts

Saturday, 6 July 2019

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.

  1. Communication using Method in LWC ( Parent to Child )
  2. Custom Event Communication in Lightning Web Component (Child to Parent )
  3. Publish Subscriber model in Lightning Web Component ( Two components which doesn't have a direct relation )
NOTE:- If you want to communicate the Lightning web component with Visualforce page then we can use Lightning Message Service (LMS).