A Northern Trail Qutfitters (NTO) developer made a tile component. To expose a click event and react to user input using the markup below, what should replace ?
To expose a click event and react to user input in a Lightning web component, the developer should use a method name as the value of the onclick attribute in the template. Themethod name should be followed by parentheses, as in tileClick(). This syntax indicates that the method is invoked when the element is clicked. The method should be defined in the JavaScript file of the component, and it can access the event object as a parameter. The other options are either invalid or incorrect. For example, {event:tileClick} is not a valid syntax for an onclick attribute, javascript:avoid(0);tileClick(); is unnecessary and outdated, and {tileClick} is a property binding expression, nota method invocation. References: B2B Commerce and D2C Commerce Developer Guide, Lightning Web Components Developer Guide
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit