December 16, 2020

What is the difference between Component Event and Application Event?

Difference between Application Event and Component Event 

The major difference between application and component event is that component event is used in child to parent components and application event can be used through out the application

Component Event:
A change in a child component can be communicated to the parent component via component event.

Application Event:
Components which have registered for this event will get notified.


Note:
Always try to use a component event instead of an application event, if possible. Component events can only be handled by components above them in the containment hierarchy so their usage is more localized to the components that need to know about them. Application events are best used for something that should be handled at the application level, such as navigating to a specific record. Application events allow communication between components that are in separate parts of the application and have no direct containment relationship.

No comments:

Post a Comment