Svelte Tutorial for Beginners - Component Events [2/2] - Event Forwarding

lihautan April 4, 2021
Video Thumbnail

About

Hi 👋 , I am lihautan (full name Tan Li Hau) a frontend engineer at Shopee Singapore. 5 things about me 😎 1️⃣ I grew up in Penang, Malaysia (a place with great food 🤤 ) 2️⃣ I am a core maintainer of Svelte https://github.com/sveltejs/svelte 3️⃣ I love frontend technologies 😍 4️⃣ I love sharing tips on Svelte, React, CSS 5️⃣ I love explaining things one layer of abstraction below 🥰 If you like what I am doing, consider buying me a coffee https://www.buymeacoffee.com/lihautan

Video Description

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 🎧 Svelte Tutorial for Beginners https://www.youtube.com/playlist?list=PLoKaNN3BjQX3mxDEVG3oGJx2ByXnue_gR 📚 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 #sveltetutorial #sveltebeginner Thanks for watching 🥰 -- with love, Li Hau

Upgrade Your Camera Gear

AI-recommended products based on this video

Loading...
COTUBLR 31 Inch Computer Desk, Home Office Desk, Simple Modern Small Desk for Bedroom, Writing Desk with Storage Bag, Study Table for Students, Grey Oak

COTUBLR 31 Inch Computer Desk, Home Office Desk, Simple Modern Small Desk for Bedroom, Writing Desk with Storage Bag, Study Table for Students, Grey Oak

(180)
$64.99
FREE delivery Thu, Jun 26
Loading...
SmallRig FX3 / FX30 HawkLock Quick Release Camera Cage Kit for Sony with XLR Handle Extension, Wrist Strap and Cable Clamp for HDMI, QR Cold Shoe, NATO Rail/QR Plate for Arca,Titanium Gray - 4771

SmallRig FX3 / FX30 HawkLock Quick Release Camera Cage Kit for Sony with XLR Handle Extension, Wrist Strap and Cable Clamp for HDMI, QR Cold Shoe, NATO Rail/QR Plate for Arca,Titanium Gray - 4771

(72)
$174.24$162.04
FREE delivery Thu, Jun 19
Loading...
koolehaoda L Shape Camera Bracket, Video Vertical Shooting Quick Release Plate L Stand Arca Swiss Compatible for Tripod Head Ballhead DSLR Camera

koolehaoda L Shape Camera Bracket, Video Vertical Shooting Quick Release Plate L Stand Arca Swiss Compatible for Tripod Head Ballhead DSLR Camera

(87)
$23.98
FREE delivery Thu, Jun 19 on your first order
Loading...
ANXRE 71" Phone Tripod, NT79 Extendable Selfie Stick for Cell Phone&Camera Photo Video Kits, Travel Tripod Stand with Remote for Video Recording, Phone Holder Tripod Compatible with Phone Camera Gopro

ANXRE 71" Phone Tripod, NT79 Extendable Selfie Stick for Cell Phone&Camera Photo Video Kits, Travel Tripod Stand with Remote for Video Recording, Phone Holder Tripod Compatible with Phone Camera Gopro

(752)
$23.99
FREE delivery Tue, Aug 19 on your first order
2K+ bought in past month
Loading...
NEEWER Advanced 18 inch LED Ring Light for Phone, LCD Touch Screen, 2.4G Remote Lights Control, 3200-5600K, Tripod Light for iPhone Action Camera, for Studio Makeup TikTok YouTube Video Salon (Black)

NEEWER Advanced 18 inch LED Ring Light for Phone, LCD Touch Screen, 2.4G Remote Lights Control, 3200-5600K, Tripod Light for iPhone Action Camera, for Studio Makeup TikTok YouTube Video Salon (Black)

(2,807)
$181.49
FREE delivery Sun, Aug 10
Loading...
SmallRig ZV-E1 Camera Baseplate for Sony ZV-E1, Built-in Cold Shoe Mount and QR Plate (for Arca) Quick Switch Between Tripod and Stabilizer for DJI RS 2 / RSC 2 / RS 3 / RS 3 Pro - 4314

SmallRig ZV-E1 Camera Baseplate for Sony ZV-E1, Built-in Cold Shoe Mount and QR Plate (for Arca) Quick Switch Between Tripod and Stabilizer for DJI RS 2 / RSC 2 / RS 3 / RS 3 Pro - 4314

(3)
$44.99
FREE delivery Thu, Jun 19
Loading...
Inland 32GB Class 10 SDHC Flash Memory Card Standard Full Size SD Card USH-I U1 Trail Camera by Micro Center (2 Pack)

Inland 32GB Class 10 SDHC Flash Memory Card Standard Full Size SD Card USH-I U1 Trail Camera by Micro Center (2 Pack)

(41,906)
$35.32$35.15
FREE delivery Sun, Jun 15
Loading...
AKASO V50 Elite 4K60fps Touch Screen WiFi Action Camera Voice Control EIS 131 feet Waterproof Camera 8X Zoom Remote Control with with 64GB U3 MicroSDXC Memory Card Global Recycled Standard

AKASO V50 Elite 4K60fps Touch Screen WiFi Action Camera Voice Control EIS 131 feet Waterproof Camera 8X Zoom Remote Control with with 64GB U3 MicroSDXC Memory Card Global Recycled Standard

(848)
$219.99
FREE delivery Sun, Aug 24
Loading...
2 Pack Micro Memory Card 128 GB with Adapter, C10/U3/UHS-I/A1, TransFlash Card, TF Card for Camera, Smartphone, Tablet, Drone (Red 128GB *2)

2 Pack Micro Memory Card 128 GB with Adapter, C10/U3/UHS-I/A1, TransFlash Card, TF Card for Camera, Smartphone, Tablet, Drone (Red 128GB *2)

(1,022)
$28.49
FREE delivery Sun, Aug 10 on your first order
500+ bought in past month
Loading...
Mini Body Camera Video Recorder, Pocket Camera, Tiny Camera, Nanny Small Cam, Body Spy Camera, Small Security Camera for Home Outdoor Office and More (with 32G Red Super high-Speed Memory Card)

Mini Body Camera Video Recorder, Pocket Camera, Tiny Camera, Nanny Small Cam, Body Spy Camera, Small Security Camera for Home Outdoor Office and More (with 32G Red Super high-Speed Memory Card)

(128)
$75.98
FREE delivery Jun 16 - 19 Only 3 left in stock.
Loading...
10 Inch Tablet, Android 15 Tablets with 18GB RAM+128GB ROM(Expand to 1TB), Octa Core 1280 * 800 IPS HD Display, 6000mAh Battery, Dual 5MP+8MP Camera, 5G/2.4G WiFi

10 Inch Tablet, Android 15 Tablets with 18GB RAM+128GB ROM(Expand to 1TB), Octa Core 1280 * 800 IPS HD Display, 6000mAh Battery, Dual 5MP+8MP Camera, 5G/2.4G WiFi

(40)
$109.99
FREE delivery Wed, Aug 27
100+ bought in past month
Loading...
LICAEVEY 84MP Digital Camera, 6K 18X Optical Zoom Wide Angle DSLR Camera, 1500mAh Li Battery 3 Inch LCD Vlogging Camera for Travel Recording Video (Black)

LICAEVEY 84MP Digital Camera, 6K 18X Optical Zoom Wide Angle DSLR Camera, 1500mAh Li Battery 3 Inch LCD Vlogging Camera for Travel Recording Video (Black)

(0)
$124.30
FREE delivery Aug 19 - 29
Loading...
eufy Security, eufyCam S220 (eufyCam 2C Pro) 2-Cam Kit, Wireless Home Security Camera, 2K Resolution, 180-Day Battery Life, HomeKit Compatibility, IP67, Night Vision, Motion Only Alert, No Monthly Fee

eufy Security, eufyCam S220 (eufyCam 2C Pro) 2-Cam Kit, Wireless Home Security Camera, 2K Resolution, 180-Day Battery Life, HomeKit Compatibility, IP67, Night Vision, Motion Only Alert, No Monthly Fee

(2,743)
$219.99
FREE delivery Thu, Sep 4
100+ bought in past month
Loading...
Weelikeit Tablet 10 inch, Android 14 Tablets with Octa-Core Processor 12GB(6+6) RAM 128GB ROM, 1200x1920 FHD Screen, 5G WiFi, 5MP+13MP Dual Camera, Bluetooth 5.0, 7000mAh Battery (Gray)

Weelikeit Tablet 10 inch, Android 14 Tablets with Octa-Core Processor 12GB(6+6) RAM 128GB ROM, 1200x1920 FHD Screen, 5G WiFi, 5MP+13MP Dual Camera, Bluetooth 5.0, 7000mAh Battery (Gray)

(100)
$79.99
FREE delivery Wed, Aug 27