Vue · Junior · Question 41 of 75

What is onUnmounted used for?

Explanation

Anything set up manually in onMounted (setInterval, addEventListener) must be torn down in onUnmounted, or it keeps running and leaks memory.

Further reading

Problem with a question

Vue · Junior · question 41

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz