nerdexam
Salesforce

PDI · Question #16

Which two are best practices when it comes to component and application event handling? (Choose two.)

The correct answer is A. Reuse the event logic in a component bundle, by putting the logic in the helper. C. Handle low-level events in the event handler and re-fire them as higher-level events. Best practices for Lightning component and application event handling include reusing event logic in the helper and handling low-level events by re-firing them as higher-level events.

Submitted by viktor_hu· Apr 18, 2026User Interface

Question

Which two are best practices when it comes to component and application event handling? (Choose two.)

Options

  • AReuse the event logic in a component bundle, by putting the logic in the helper.
  • BUse component events to communicate actions that should be handled at the application level.
  • CHandle low-level events in the event handler and re-fire them as higher-level events.
  • DTry to use application events as opposed to component events.

How the community answered

(44 responses)
  • A
    89% (39)
  • B
    5% (2)
  • D
    7% (3)

Why each option

Best practices for Lightning component and application event handling include reusing event logic in the helper and handling low-level events by re-firing them as higher-level events.

AReuse the event logic in a component bundle, by putting the logic in the helper.Correct

Placing shared event handling logic in the component's helper JavaScript file promotes code reuse across multiple handlers or components and improves maintainability by centralizing business logic.

BUse component events to communicate actions that should be handled at the application level.

Component events are designed for contained communication within a component hierarchy, whereas application events are more appropriate for actions handled at the global or application level.

CHandle low-level events in the event handler and re-fire them as higher-level events.Correct

Handling granular, low-level events and encapsulating them by re-firing as more abstract, higher-level events simplifies component communication and reduces tight coupling between disparate components.

DTry to use application events as opposed to component events.

It is generally a best practice to prefer component events over application events because application events have a broader scope, which can make debugging and managing event flows more challenging.

Concept tested: Lightning Event Handling Best Practices

Source: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_best_practices.htm

Topics

#Event Handling#Lightning Components#Best Practices#Code Reusability

Community Discussion

No community discussion yet for this question.

Full PDI Practice