Vue · Middle · Question 8 of 75

Why is mutating state inside a computed getter a bug?

Explanation

Vue may run the getter at any time (or not at all if nothing reads it). Use a watcher for side effects and keep computed purely derived.

Further reading

Problem with a question

Vue · Middle · question 8

Test yourself

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

Take this quiz