My_Test_Repo/force-app/main/default/lwc/pubSubComponentB/pubSubComponentB.js

13 lines
366 B
JavaScript

import { LightningElement } from 'lwc';
import pubSubComponent from 'c/pubSubComponent';
export default class PubSubComponentB extends LightningElement {
message;
connectedCallback(){
this.callsubscriber()
}
callsubscriber(){
pubSubComponent.subscribe('componentA',(message)=>{
this.message = message;
});
}
}