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
Parteek Goyal 3Parteek Goyal 3 

why we use custom component event in salesforce lightning?

Why do we use component custom event in Lightning, what are the use case of using custom component events.

Standard event like button click can do any work in lighting still we use custom components event, Please explain.

Veena Sundara-HeraguVeena Sundara-Heragu
events are used to communicate between components.  component events geenrated by a component can be handled by its ancestors in the component hierarchy. 
Ashif KhanAshif Khan
Hi Parteek 
We use component events to communicate with parent component as Veena Sundara said. Using component event we can pass values from child to parent component and can manipulate parent data as per child record changes. Standard Events like button click only use for calling the component JS controller actions.
Parteek Goyal 3Parteek Goyal 3
Hi Veena/Ashif,

Thanks for quick response.
I am still not clear about component events, could you please elobrate a use case with some code.
Ashif KhanAshif Khan
Hi Parteek,  

This is a blog in which two events are using.