Svelte · Middle · Question 48 of 75
What does this code show after clicking the button?
<script>
let todos = $state([{ text: "A", done: false }]);
const first = todos[0];
</script>
<button onclick={() => (first.done = true)}>Done</button>
<p>{todos[0].done}</p>- ✓Correct answer:
true:firstis the same proxy astodos[0], so mutating it updates the UI - 2
false:firstis a plain copy - 3An error
Explanation
Reading an object property from a deep state proxy returns a proxy too. Destructuring primitives, however, loses reactivity.