I'm confused about what documentation says about event best practices.
CustomEvent.detail
To communicate data to elements in the same shadow tree, don’t add myProperty into event.detail. The consumer of the event can use the event.target.myProperty. To communicate data to elements that aren’t in the same shadow tree, use event.detail.
Doesn't these sentences contradict one another? In both instances you're supposed to use event.detail. What is the difference they are trying to convey here?
new CustomEvent('select', { detail: this.contact.Id });
And here's how they handle it:const contactId = event.detail;
– Martin Lezer Oct 28 '19 at 9:51