Svelte · Middle · Question 7 of 75
When is $state.raw a good choice?
let rows = $state.raw([]);
rows = await fetchRows(); // reassign, don't push- ✓Correct answer: For large objects or arrays that are replaced as a whole (like API responses), to avoid proxy overhead
- 2For values that must never change
- 3For state shared with the server
Explanation
Raw state isn't deeply reactive: rows.push(x) won't trigger updates, only reassignment does.