3

Lightning developer guide says that events can be inherited.

A sub component that extends a super component can handle events fired by the super component. The sub component automatically inherits the event handlers from the super component.

The super and sub component can handle the same event in different ways by adding an tag to the sub component. The framework doesn't guarantee the order of event handling.

But it also says that

We don't recommend using inheritance of client-side controllers as this feature may be deprecated in the future to preserve better component encapsulation. We recommend that you put common code in a helper instead.

1
  • No one knows for sure but you better code like it will be or have trouble later. Consider yourself warned so to speak
    – Eric
    Dec 12, 2016 at 7:04

1 Answer 1

3

I did some research following are my observations -

  • The event registered using

      <aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/>
    

    will be inherited and recommended.

  • Each sub component should declare its own handler.
  • Any abstract component ideally should not have any controller.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .