Svelte · Junior · Question 36 of 76
When does onMount run?
- ✓Correct answer: After the component is first mounted in the DOM, in the browser only
- 2Before the component renders, on the server and in the browser
- 3Every time the state changes
Explanation
A function returned from onMount runs when the component is destroyed. It doesn't run during SSR.