useState()

useState()

useState() creates framework-managed shared state.

const count = useState('count', () => 0)

Behavior

  • server-side state is request-scoped
  • client state is hydrated from the SSR payload
  • the same key resolves the same shared ref within the app