Function: useSharedState()
@roomful/react / useSharedState
Function: useSharedState()
Section titled “Function: useSharedState()”useSharedState<
T,TPresence>(key,options): readonly [T,Dispatch<SetStateAction<T>>]
Defined in: react/src/index.ts:653
Binds a shared state value to React state semantics.
Type Parameters
Section titled “Type Parameters”T
The shared state value type.
TPresence
Section titled “TPresence”TPresence extends PresenceData = PresenceData
The room presence shape.
Parameters
Section titled “Parameters”string
The logical binding key used to enforce a single shared-state binding per room.
options
Section titled “options”StateOptions<T>
The shared-state configuration.
Returns
Section titled “Returns”readonly [T, Dispatch<SetStateAction<T>>]
The current shared state value and a React-style setter.