Alex
Alex

Reputation: 68482

Vue computed properties

If I need to access a computed property 20 times in one function, is it better to assign the value of it to a local variable first?

Would that improve performance?

Upvotes: 4

Views: 164

Answers (1)

user443917
user443917

Reputation:

Computed properties are cached based on their reactive dependencies ... Computed Caching vs Methods

Vue.js automatically cache the computed value, as long as their reactive dependencies don't mutate.

Storing it in a variable would be counter-intuitive.

Upvotes: 6

Related Questions