[SOLVED] differences between beforeUpdate and watch Vue3 – Stack Overflow


This Content is from Stack Overflow. Question asked by NicolaL1995

Im actually learning Vue3.
It seems generally very clear to me.
But one thing is not clear at all.
The differecens between watch and beforeUpdate.
There are differences between this two?
And if yes, when is preferred use one rather than another?


Yes there are many differences. Watch observes only changes in the reactive data passed as the first argument, so it only operates after the monitored properties have changed. As for beforeUpdate , it is a life cycle that is called before the DOM is changed due to reactive data changes in the component, So it observes any reactive data in the component.

This Question was asked in StackOverflow by NicolaL1995 and Answered by Boussadjra Brahim It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?