Valid AP-202 Dumps shared by EduDump.com for Helping Passing AP-202 Exam! EduDump.com now offer the newest AP-202 exam dumps, the EduDump.com AP-202 exam questions have been updated and answers have been corrected get the newest EduDump.com AP-202 dumps with Test Engine here:
A developer needs to create an event listener on a parent component programmaticallv. With the script below, what should replace the text <EVENT LISTENER UNE>?
Correct Answer: C
To create an event listener on a parent component programmatically, the developer should use the following line of code: this.template.addEventListener('notification', this.handleNotification); This line of code adds an event listener to the template element of the parent component, which is the root element that contains all the child elements. The event listener listens for an event named 'notification', which is a custom event that can be dispatched by any child component. The event listener invokes a method named handleNotification, which is an arrow function defined in the parent component class. The handleNotification method receives the event object as a parameter and can perform any logic based on the event data. The other lines of code are either incorrect or incomplete. Salesforce Lightning Web Components Developer Guide: Communicate with Events, Lightning Web Components Developer Guide: Create and Dispatch Events