Hi Piyush,
You can use api methods in LWC. These are exposed to parent components when decorated api. Here is an example:
Aura component:
cmp:
<lightning:button label=”Get From Poc” onclick=”{!c.getFromPoc}” />
<c:poc aura:id=”poc” />
and its JS:
getFromPoc : function (component, event, helper) {
let myData = component.find("poc").getMyData();
console.log("myData => ", myData);
},
Now the child LWC component POC:
JS:
import { LightningElement, wire, api } from 'lwc';
export default class Poc extends LightningElement {
@apigetMyData() {
return 'some data from poc';
}
}
This method getMyData is exposed and can be invoked from parent component (Aura or LWC). Syntax will be same as aura:method invocation as you can see in aura component getFromPocmethod.
Thanks