Create and Dispatch Events
Handle Events
Configure Event Propagation
Communicate Across the DOM
Events Best Practices
Dynamic Event Listeners Considerations
Develop Secure Code
Consider these guidelines when using lwc:on.
lwc:on is not allowed. To modify a property on the object, pass a new object instead. Reusing the same object with modified properties throws an error.lwc:on to a new object is allowed.
lwc:on directive instead of lwc:spread for dynamically adding event listeners.lwc:on and an onevent listener for the same event type in the HTML template throws an error.lwc:on and lwc:spread to specify listeners for the same event type results in both event listeners getting added to the element.To set properties and attach event listeners based on which component is dynamically loaded, use these template directives on your component.
lwc:component and lwc:islwc:spreadlwc:onSee Also
Release Preview