Lightning Aura.Action Attributes

In this blog, I am going to explain salesforce lightning Aura.Action Attribute Type.With the Aura.Action attribute type you can able to pass the actions handlers from the parent component to child components such as on-click or other HTML actions like on** actions.  Although Aura.Action works for passing an action handler to a child component, its recommended for registering an event in the child component and firing the event in the child’s controller instead. Then, handle the event in the parent component. This example demonstrates how to pass an action handler from a parent component to a child component.Here’s the child component with the Aura.Action attribute. The on-click handler for the button uses the value of the on-click attribute, which has the type of Aura.Action.Create the new Lightning component with below code.

The above component is having two Aura.Action attributes which are used to pass from the parent component to child component on invoke on button press and click on div section handler actions.


The below component  is parent component which passes the action to the child component


Now if you see the above app, when the user clicks on the Press Me button it will pass the action handler from the parent component to child component. Similarly, even user click on Click Me text also passes the action handler to child component and update the parent component.