• Docs
  • Modules
  • Showcase
  • Support

Docs

  • Get Started
  • Guide
  • API
  • Examples
  • Community
  • Essentials
    • Hello World
  • App
    • app.config
    • Error Handling
    • Plugins
    • Teleport
  • Auto Imports
    • Components
    • Composables
  • Composables
    • useAsyncData
    • useCookie
    • useFetch
    • useHead
    • useState
  • Routing
    • Layouts
    • Middleware
    • <NuxtLink>
    • Pages
    • Universal Router
  • Server
    • Server Routes
  • Advanced
    • Config Extends
    • JSX / TSX
    • Module Extend Pages
    • Testing
  • Experimental
    • Reactivity Transform
    • WASM
  • Other
    • Locale

useState

This example showcase the useState composable, an SSR-friendly ref replacement.

Its value will be preserved after server-side rendering and shared across all components using a unique key.

Learn more about useState.
Read more in Docs > Api > Composables > Use State.
Read more in Docs > Getting Started > State Management.
Loading Sandbox...

Edit on Github
© 2022 Nuxt - MIT License
  • Support
  • Design Kit
  • NuxtLabs
  • Nuxt Studio