Skip to content

Commit 8bb7480

Browse files
Added a warning regarding async setup (#2105)
* chore: added a warning regarding async setup * Update src/api/composition-api-setup.md Co-authored-by: skirtle <[email protected]> * fix: removed tips Co-authored-by: skirtle <[email protected]>
1 parent 008c9ab commit 8bb7480

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/api/composition-api-setup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ export default {
3838
</template>
3939
```
4040

41-
Note that [refs](/api/reactivity-core.html#ref) returned from `setup` are [automatically shallow unwrapped](/guide/essentials/reactivity-fundamentals.html#deep-reactivity) when accessed in the template so you do not need to use `.value` when accessing them. They are also unwrapped in the same way when accessed on `this`.
41+
[refs](/api/reactivity-core.html#ref) returned from `setup` are [automatically shallow unwrapped](/guide/essentials/reactivity-fundamentals.html#deep-reactivity) when accessed in the template so you do not need to use `.value` when accessing them. They are also unwrapped in the same way when accessed on `this`.
4242

43-
:::tip
4443
`setup()` itself does not have access to the component instance - `this` will have a value of `undefined` inside `setup()`. You can access Composition-API-exposed values from Options API, but not the other way around.
45-
:::
44+
45+
`setup()` should return an object _synchronously_. The only case when `async setup()` can be used is when the component is a descendant of a [Suspense](../guide/built-ins/suspense.html) component.
4646

4747
## Accessing Props {#accessing-props}
4848

0 commit comments

Comments
 (0)