Lightning Web Component(LWC) Components Communication in Salesforce

Lightning Web Component(LWC) Components Communication in Salesforce

Communicate from Parent to Child

The @api decorator in the child component exposes a property, making it public, so that the parent component can update it.

Similarly, @api decorator function in child component can expose it as public to call it from the parent component.

Check this for sample code and implementation

Communicate from child to parent

CustomEvent can be used.

Check this for sample code and implementation

Communicate between Unrelated Components

Lightning Message Channel can be used.

Check this for sample code and implementation

Leave a Reply