Skip to main content
InterviewHubPRO
Section Overview
Q9

Question 9 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

18%
Svelte & SvelteKit (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

Form Bindings: Two-Way Data Binding in Svelte.

junior LevelCode ExampleComponentsFormsSvelte 5

In Simple Words: Instead of writing manual value={val} and onChange={(e) => val = e.target.value}, Svelte provides the concise bind: directive:

svelte
<script>
  let email = $state('');
  let agreed = $state(false);
  let color = $state('red');
</script>

<input type="text" bind:value={email} />
<input type="checkbox" bind:checked={agreed} />

<select bind:value={color}>
  <option value="red">Red</option>
  <option value="blue">Blue</option>
</select>