To sync an attribute of an element to a variable, you’ll need to
1) Add an event handler to the element - so changes on the element will update the variable.
2) Pass the variable to the attribute - so changes on the variable will update the element
Instead of doing 2 steps, we can combine both into 1 bind: directive.
In this video, we are going to look at how we can use binding to bind a variable to an attribute of an element.
p/s: binding works for component too!
Introduction 00:00
Syncing an attribute value to a variable 00:12
Binding element attribute with the bind: directive 01:52
Shorthand for bind: 04:57
Binding component props 05:48
---
💻 REPL
📚 Related Resources
Svelte
Svelte REPL
Svelte Tutorial: Bindings
Svelte Tutorial: Component Bindings
🥰 Support me
1 view
428
118
10 months ago 01:16:00 1
Часть 1. Делаем чат на Svelte. NodeJs. GraphQL и Websockets. Верстка.
12 months ago 00:05:01 1
1999 Jaguar XJR For Sale Gateway Classic Cars Orlando #1869
1 year ago 02:54:25 1
Web Development In 2023 - A Practical Guide
2 years ago 00:20:58 1
Система нотификаций с Redux Thunk
2 years ago 00:18:23 1
Что такое КОМПОЗИЦИЯ в Redux Thunk?
2 years ago 00:12:05 1
Что такое Redux Thunk?
2 years ago 01:05:03 1
Как быстро начать программировать?
3 years ago 00:19:42 3
gQuery 101
3 years ago 00:05:20 1
How To Build a LEGO Sphere
4 years ago 00:29:30 1
Svelte 101: svelte options
4 years ago 00:04:07 1
Svelte 101: svelte:body
4 years ago 00:08:16 1
Svelte 101: svelte:window
4 years ago 00:09:38 1
Svelte 101: svelte:head
4 years ago 00:06:17 1
Svelte 101: svelte:self
4 years ago 00:34:50 1
Svelte 101: Lazy Component
4 years ago 00:09:22 1
Svelte 101: svelte:component
4 years ago 00:25:56 1
Svelte 101: $$props and $$restProps
4 years ago 00:34:37 7
Svelte 101: Tabs
4 years ago 00:27:21 1
Svelte 101: Infinite List
4 years ago 00:09:29 1
Svelte 101: $$slots
4 years ago 00:16:56 1
Svelte 101: Slots Forwarding
4 years ago 00:09:29 1
Svelte 101: Passing data across slot
4 years ago 00:13:09 5
Svelte 101: Slot to compose components
4 years ago 00:13:26 1
Svelte 101: Recreate elements and components when value changes with {#key} block