Svelte · Junior · Question 12 of 76
What does $effect do?
- ✓Correct answer: Runs code after the component is mounted and again whenever the state it read changes
- 2Runs code once on the server before rendering
- 3Declares derived state
Explanation
Effects are for side effects: working with canvas, third-party libraries, subscriptions. They run in the browser only, not during SSR.