Svelte · Senior · Question 5 of 75
What does it mean that $effect dependencies are dynamic?
$effect(() => {
if (enabled) draw(color);
});- ✓Correct answer: Only values read in the last run count: when
enabledis false, changes tocolordon't re-run the effect - 2Dependencies are fixed at compile time
- 3All variables in the function body are dependencies
Explanation
This is precise and efficient, but it's also why conditionally read state may seem "not tracked".