You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page documents the usage of the `setup` component option. If you are using Composition API with Single-File Components, [`<script setup>`](/api/sfc-script-setup.html) is recommended for a more succinct and ergonomic syntax.
5
-
:::
3
+
## Basic Usage {#basic-usage}
6
4
7
5
The `setup()` hook serves as the entry point for Composition API usage in components in the following cases:
8
6
9
7
1. Using Composition API without a build step;
10
8
2. Integrating with Composition-API-based code in an Options API component.
11
9
12
-
## Basic Usage {#basic-usage}
10
+
:::info Note
11
+
If you are using Composition API with Single-File Components, [`<script setup>`](/api/sfc-script-setup.html) is strongly recommended for a more succinct and ergonomic syntax.
12
+
:::
13
13
14
14
We can declare reactive state using [Reactivity APIs](./reactivity-core.html) and expose them to the template by returning an object from `setup()`. The properties on the returned object will also be made available on the component instance (if other options are used):
0 commit comments