function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Balajee SelvarajBalajee Selvaraj 

Lightning component refresh from child component to parent component.

Hi All,

I am having 2 Lightning Component. 
Lightning Component - A  having Button.
If I am clicking on the button in Lightning Component - A. Lightning Component - B should refresh. 

Do you have any sample codes please post below.
refer this repository 
Shivdeep KumarShivdeep Kumar
I can not see full detail about what you need but for two component there is two scenario :

1- If Component A is child of component B thn,
// create a attribute in component A
<aura:attribute name="onclick" type="aura:action"/>

// component B

// component A
<aura:component onclick="{!c.refresh}"/>


// Controller
refresh : function(component, event, helper) {
    var action = cmp.get('c.myController');
        function(response) {
            var state = response.getState();
            if (state === 'SUCCESS'){
            } else {
                 //do something
It will refresh the component B.

you can use the component type event, which will fire from component A and refresh the component B. in this case event handler will be used on parent component and register handler will used on child component.

If Component A and component B has no relation OR you want to refresh the child component from parent component then use Application event and do similar as above (as per your requirement).

Ramakrishna Reddy GouniRamakrishna Reddy Gouni
you can call doinit method again by using aura method from child component. i hope if you call doint(on load methods) i.e works for you. 
Alain CabonAlain Cabon

The standard way is to use an event (component or application event). The handler in parent can perform the refresh.

Documentation: 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.​

The reference article by Philippe Ozil: Lightning Inter-Component Communication Patterns​
Ravi Dutt SharmaRavi Dutt Sharma
Components communicate with each other through events. There are 2 types of events in Lightning - component event and application events. If you want to communicate from child component to parent component, use a component event. If you want to broadcast an information to the entirie application, use an application event.

Here is an example of component event given by Salesforce: