Vue · Senior · Question 5 of 75
What is effectScope for?
const scope = effectScope();
scope.run(() => {
const doubled = computed(() => counter.value * 2);
watch(doubled, log);
});
scope.stop();- ✓Correct answer: Collecting computed refs and watchers created inside so they can be disposed together
- 2Running effects on the server
- 3Making effects run in parallel
Explanation
Components create a scope automatically. Manual scopes are used in libraries and shared composables (e.g. a singleton store created outside components) to avoid leaking effects.