Vue: getting started

Lesson 06 · 11 min

watch: a side effect on change

Computed is a formula. watch is for calling an API when the id changed.

watch(id, (next) => { load(next) }) fires when id changes. watchEffect collects its dependencies from whatever it read. Don't put into a watch what can be a computed: filtering a list is computed, a request to the server is watch.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.