Data attributes give you the ability to specify custom attributes on any elements with the HTML of your Lightning Web Component. In this quick take, we will take a list of contacts and understand how data attributes can help us identify the clicked element and act on the data.
Check out the code on github: https://github.com/schandlergarcia/lwc-element-explorer
Take the “Learn to work with Javascript” Trail on Trailhead: https://trailhead.salesforce.com/en/content/learn/trails/learn-to-work-with-javascript
Learn more about Data Attributes: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
Learn more about Filters in Javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
Track: BeatFort – Rampant Sunrise
Music provided by Ninety9Lives
Stream / Free Download: 99l.tv/rampantsunriseYU