There are mainly 3 approaches for communication between the Lightning components using events. Communication using Method in LWC ( Parent to Child ) Custom Event Communication in Lightning Web Component (Child to Parent ) Publish Subscriber model in Lightning Web Component ( Two components which doesn't have a direct relation ) 1. Communication using Method in LWC ( Parent to Child ) we can call the method of Child Component from the Parent Component with the help of JavaScript Methods. LWC have used @api decorator to make the children properties public available so parent can be able to call it directly using JavaScript API. For example create one public variable and method (which we need to access in parent component) in ChildComponent with @api decorator like below: ChildComponent: import { LightningElement , api } from 'lwc' ; export default class HelloWorld extends LightningElement { @ api name ; @ api message ; @ api upperCas
Everything about Salesforce