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?
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.
DRY
when you use a same value over and over again IMO it's better to it stored in variable instead of referencing it everytime like,obj.whatever
– Code Maniacfunction
that uses it 20 times. (And reallyDRY
is the way to go even with negligible performance tradeoffs isn't it.) – ambianBeing