Video details

Svelte 101: Component Events - Event Forwarding [2/2]

Svelte
03.27.2021
English

DOM events bubble. When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.
Do component event works the same way? Does it run the handler on the component, then on its parent component, then all the way up?
You'll find in the video that, the answer is no.
And we are going to take a look how we can recreate the event bubbling behaviour for component events.
Introduction 00:00 DOM event bubbling 00:29 Component event forwarding 03:41 DOM event forwarding 08:41
---
💻
REPL https://svelte.dev/repl/cfcb6407b0c44b6298a4fd27f7aec109?version=3.35.0
📚
Related Resources Svelte https://svelte.dev Svelte REPL https://svelte.dev/repl Svelte Tutorial: Event forwarding https://svelte.dev/tutorial/event-forwarding Svelte Tutorial: DOM Event forwarding https://svelte.dev/tutorial/dom-event-forwarding JavaScript.info: Event bubbling and capturing https://javascript.info/bubbling-and-capturing
🥰 Support me https://www.buymeacoffee.com/lihautan
🔗
Want to learn more from me? Check out these links:
Twitter: https://twitter.com/lihautan Blog: https://lihautan.com/ Newsletter: https://lihautan.com/newsletter
#svelte #svelte101
Thanks for watching 🥰 -- with love, Li Hau