Two Way Bind

<MyInput bind:value={value} />
// Shorthand
<MyInput bind:value />
<select multiple bind:value={fillings}>
  <option value="Rice">Rice</option>
  <option value="Beans">Beans</option>
  <option value="Cheese">Cheese</option>
</select>
<input 
  type="radio" 
  bind:group={tortilla} 
  value="Plain" />
<input
  type="radio" 
  bind:group={tortilla} 
  value="Whole wheat" />
<input 
  type="checkbox" 
  bind:group={fillings} 
  value="Rice" />
<input 
  type="checkbox" 
  bind:group={fillings} 
  value="Beans" />
// Element Binding
<script>
  let myDiv
</script>
<button on:click={() => myDiv.innerText = 'My text'}>
  Click
</button>
<div bind:this={myDiv}/>
Comments
Related