Counter: {{ count }}
{{ user.email }}
Theme: {{ user.preferences.theme }}
{{ productCount }} products - Total: ${{ totalValue }}
First name: {{ firstName }}
Last name: {{ lastName }}
``` ## watchとwatchEffectによるウォッチャー ウォッチャーはデータの変更に応じて副作用を実行します。Vue 3には2つのアプローチがあります。精密に制御できる`watch`と、依存関係を自動追跡する`watchEffect`です。 > **watchとwatchEffectの使い分け** > > `watch`は依存関係を明示的に指定でき、変更前後の値を取得できます。`watchEffect`は、使用しているすべてのリアクティブな依存関係で自動的に実行されるため、シンプルに書けます。 ```javascript // SearchComponent.vueLoading...
Loading users...
Error: {{ error }}
Window width: {{ windowWidth }}px
DOM updates: {{ updateCount }}
Count: {{ count }}
Current theme: {{ theme }}