Phong Duong

🔎Search

Input binding in Svelte

12-08-2020 | #svelte

Application often uses form. In Svelte, you don't need to listen to on:input event and update the value then. You can use bind:value directive to update the value. You can use shorthand form if the names match

<input bind:value={name}>
// shorthand form
<textarea bind:value></textarea>

Share: TwitterFacebookLinkedInHacker News