Reputation: 1202
In this example, is bookCount
memoized the same way as a computed
ref is?
const author = reactive({
name: 'John Doe',
books: [
'Vue 2 - Advanced Guide',
'Vue 3 - Basic Guide',
'Vue 4 - The Mystery'
],
get bookCount() {
return this.books.length
}
})
Upvotes: 0
Views: 419
Reputation: 6909
No, it is not. The getter will be executed everytime the property is accessed.
You can check it by using the getter in the template, and provoke a template re-render. You'll see the getter will be executed at every render, while a regular computed
won't (as long as the value didn't change).
Check out this example on sfc.vuejs.org
Upvotes: 2