Computed properties are cached reactive values that update only when their dependencies change. They're declarative and automatically track their reactive dependencies.
computed: {
fullName() {
return this.firstName + ' ' + this.lastName
},
expensiveValue() {
// This will only re-run when dependencies change
return this.items.filter(item => item.price > 100)
}
}
Benefits:
Caching for performance
Declarative and readable
Automatic dependency tracking
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.