Svelte · Senior · Question 7 of 75
What is the cost of deep $state proxies, and how do you control it?
- ✓Correct answer: Every property access goes through a proxy and nested objects are wrapped lazily; for large immutable data use
$state.rawor plain variables - 2There is no cost; proxies are free
- 3Proxies copy the object on each read
Explanation
Only use $state for values that drive effects, deriveds or the template. Non-reactive data can stay in normal variables.