I open VueJS, and I definitely don’t understand the difference between updatedand observers.
Updated hook
This is a life cycle hook. According to the official documentation , it runs whenever data changes. Therefore, whenever propor data(value, not just a pointer) is updated updated.
Watchers
In the documentation, observers are compared with calculated properties. But in what cases would it be better to use updated ones instead of observers?
It seems that in both cases the DOM is not updated when calling callback ( nextTick()required if we want to manipulate the changes in the DOM). The only difference I see is that it watchersonly works when updating one exact property (or data), where it is always called updated.
I can’t understand what advantages of updating are updated when data ( updating) changes , if we can be more precise ( watchers).
Here are my thoughts.
Thank:)
source
share