2022-03-30 15:59:28 +00:00
|
|
|
---
|
2022-10-06 09:15:30 +00:00
|
|
|
toc: false
|
2022-03-30 15:59:28 +00:00
|
|
|
---
|
|
|
|
|
2022-11-08 17:03:18 +00:00
|
|
|
# useState
|
|
|
|
|
|
|
|
This example showcase the `useState` composable, an SSR-friendly ref replacement.
|
|
|
|
|
2022-10-06 09:15:30 +00:00
|
|
|
Its value will be preserved after server-side rendering and shared across all components using a unique key.
|
2022-03-30 15:59:28 +00:00
|
|
|
|
|
|
|
::alert{type=info icon=👉}
|
2022-11-16 10:04:28 +00:00
|
|
|
Learn more about [useState](/docs/api/composables/use-state).
|
2022-04-06 05:56:08 +00:00
|
|
|
::
|
|
|
|
|
2022-11-16 10:04:28 +00:00
|
|
|
::ReadMore{link="/docs/api/composables/use-state"}
|
2022-04-06 05:56:08 +00:00
|
|
|
::
|
|
|
|
|
2022-11-16 10:04:28 +00:00
|
|
|
::ReadMore{link="/docs/getting-started/state-management"}
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
::sandbox{repo="nuxt/framework" branch="main" dir="examples/composables/use-state" file="app.vue"}
|
2022-10-06 09:15:30 +00:00
|
|
|
::
|