Conceptual
Login

The watchEffect Function

watchEffect(fn) runs its function immediately and re-runs it whenever anything it read changes, collecting dependencies automatically on each run with no old-value access. By default it flushes pre (before DOM update); flush: 'post' waits for the DOM and flush: 'sync' runs immediately on every trigger, and await nextTick() is how code waits for the post-update DOM.

This Concept is waiting for its first lesson!

watchEffect(fn) runs its function immediately and re-runs it whenever anything it read changes, collecting dependencies automatically on each run with no old-value access. By default it flushes pre (before DOM update); flush: 'post' waits for the DOM and flush: 'sync' runs immediately on every trigger, and await nextTick() is how code waits for the post-update DOM.

Are you a teacher? Sign in to start contributing.

Sign In