Svelte · Junior · Question 15 of 76
Is an object declared with $state deeply reactive?
let todo = $state({ text: "Buy milk", done: false });
todo.done = true;- ✓Correct answer: Yes: plain objects and arrays become reactive proxies, so mutating a property updates the UI
- 2No: you must reassign the whole object
- 3Only if you call
todo.update()
Explanation
Array methods like push also trigger updates. For large data that is only reassigned, $state.raw avoids the proxy overhead.