Lit: Difference between revisions
No edit summary |
|||
Line 6: | Line 6: | ||
===Events=== | ===Events=== | ||
With Lit, data flows down DOM elements and events flow up DOM elements. This is unlike React where callback handlers are use to pass data up the DOM tree. | With Lit, data flows down DOM elements and events flow up DOM elements. This is unlike React where callback handlers are use to pass data up the DOM tree. | ||
# Create a new event name or event class. | |||
# In the parent element, use <code>this.addEventListener</code> in the constructor to set the callback for the event. | |||
# In the child class, call <code>this.dispatchEvent</code>. | |||
===React interop=== | ===React interop=== |