Svelte · Senior · Question 6 of 75
What happens with updates batched in Svelte 5?
count = 1;
count = 2;
name = "Ann";- ✓Correct answer: Effects run once, in a microtask after the synchronous code, with the final values
- 2The DOM is updated three times synchronously
- 3Only the last assignment is kept; the others are ignored even in code
Explanation
Batching avoids wasted work and intermediate states. flushSync() applies updates immediately when needed.