• Contrast watchEffect
  • 1. Lazy execution side effects, i.e. not executing the first time and waiting until the dependency changes
  • 2. Show more clearly which state changes caused the side effects to be executed

  • 3. You can access state to change the values before and after

  • 4. WatchEffect automatically collects dependent values, whereas Watch needs to manually specify the side effects itself in the second returned function

  • When the dependent value is a ref, the first argument can be written as a ref variable. Reactive doesn’t work.

Watch with multiple values monitors multiple values at the same time

+ also accepts a third parameter

  • It also returns a stop function