Skip to content

Commit d5fc7f9

Browse files
docs: update watchEffect
1 parent ddd7647 commit d5fc7f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/api/reactivity-core.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Takes an object (reactive or plain) or a [ref](#ref) and returns a readonly prox
232232
Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed.
233233

234234
:::info Usage Note
235-
`watchEffect` can only observe dependencies that are accessed during its initial execution. If you access reactive states within asynchronous operations, these states will not be collected as dependencies. Similarly, if you access these variables within an `if` statement and the condition is false during the initial execution, these variables will also not be collected as dependencies.
235+
`watchEffect` will execute immediately upon initialization. During this initial execution, `watchEffect` will collect dependencies accessed during the first run. When the dependencies change, `watchEffect` will be re-executed. In subsequent executions, `watchEffect` will only collect dependencies accessed in the previous run, thus avoiding unnecessary executions and improving performance.
236236
:::
237237
- **Type**
238238

0 commit comments

Comments
 (0)