04. Computed Properties and Watchers Flashcards

1
Q

Computed Properties

A

computed properties are cached based on their dependencies.

A computed property will only re-evaluate when some of its dependencies have changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Direferencia entre Propiedades Computadas y Métodos

A

the difference is that computed properties are cached based on their dependencies.

In comparison, a method invocation will always run the function whenever a re-render happens

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why do we need caching?

A

Why do we need caching? Imagine we have an expensive computed property A, which requires looping through a huge Array and doing a lot of computations. Then we may have other computed properties that in turn depend on A. Without caching, we would be executing A’s getter many more times than necessary! In cases where you do not want caching, use a method instead.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly