QuestionQ84

VerifiedBasic Lightning Web Component Development

A developer must programmatically create an event listener on a parent component. With the following script, what should replace the text?

Question Image

Explanation

A parent Lightning Web Component can imperatively listen for an event within its shadow boundary through this.template.addEventListener(). The method requires the event type and handler function, as in this.template.addEventListener('notification', this.handleNotification);. The arrow-function handler retains the component instance context.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!