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;

Explanation

Array methods like push also trigger updates. For large data that is only reassigned, $state.raw avoids the proxy overhead.

Further reading

Problem with a question

Svelte · Junior · question 15

Test yourself

Take the Svelte · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz