Optimal event architecture design pattern

Adding a high number of component events and application events can not only add more files to your project but can also make debugging your application more difficult.

Keep it simple by using the following patterns:

  1. Use only one component file throughout the application. The component event has the attribute namewhere can define different names. This will enable us to distinguish them without creating a separate file for each component event. To further understand this, let's take a look at the following code snippet, as an example that defines a component event. Let's name the event file genericEvt:
<aura:event type="COMPONENT" description="Generic Component Event" > <aura:attribute name="cmpData" ...

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.