Skip to content
Roomful is in public beta — install with the @beta tag. Share feedback →

Function: useSharedState()

@roomful/vue


@roomful/vue / useSharedState

useSharedState<T, TPresence>(key, options): readonly [Readonly<ShallowRef<T>>, SharedStateSetter<T>]

Defined in: vue/src/index.ts:450

Binds a shared state value to Vue refs.

T

The shared state value type.

TPresence extends PresenceData = PresenceData

The room presence shape.

string

The logical binding key used to enforce a single shared-state binding per room.

StateOptions<T>

The shared-state configuration.

readonly [Readonly<ShallowRef<T>>, SharedStateSetter<T>]

A readonly ref for the value and a setter function.