top of page
Writer's pictureSaurabh Singh

Replace Simple Aura Events with Aura Actions

An Aura.Action is a reference to an action in the framework. If a child component has an Aura.Action attribute, a parent component can pass in an action handler when it instantiates the child component in its markup. This pattern is a shortcut to pass a controller action from a parent component to a child component that it contains, and is used for on handlers, such as onclick.


In simple terms, you can call a function in parent component from child component without using Aura Event.


Note -
Although Aura.Action works for passing an action handler to a child component, we recommend 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. The event approach requires a few extra steps in creating or choosing an event and firing it but events are the standard way to communicate between components.
Aura.Action shouldn’t be used for other use cases.

Example -

We need two Aura Component, where one is parent and other one is child.


Component1 ->

Component1Controller ->


Component2 ->

Component2Controller ->



Output ->


Click on Fire Parent Method



241 views0 comments

Recent Posts

See All

Comments


bottom of page