Types of events in Aura components / Lightning Web Components
In Aura components, there are two types of events, as explained below:
Component- This type of event is fired from an instance of a component and can be handled only by the component that fired it or a component in the containment hierarchy.
Application- This type of event is fired from an instance of a component and can be handled by any component which provides a handler to listen to it.
In Lightning Web Components, there are events with the same behaviour as component and application events but with a different name and way of implementation, as explained below:
Dispatch Event- This is similar to component events. It requires you to create an event using CustomEvent() and fire using EventTarget.dispatchEvent().
Lightning Message Service or PubSub Model- is similar to application events where the components are not in the same DOM tree.
Subscribe to my newsletter
Read articles from Tarun Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Tarun Gupta
Tarun Gupta
Sr. Salesforce Developer | 2x Salesforce Certified | 5X Copado Certified | 3x Ranger | 9x Superbadge | 4x Salesforce Mentor | 1x Copado Mentor | NodeJs | JavaScript