Valora
API Reference@valora-ai/reactindexFunctions

useRoom

function useRoom<T>(props): {
  room: unknown;
  htmlProps: HTMLAttributes<T>;
};

Defined in: packages/react/src/hooks/connection/useRoom.ts:58

The useRoom hook is used to implement a room provider or your custom implementation of it. It returns a Room instance and HTML props that should be applied to the root element of the component.

Type Parameters

Type ParameterDefault type
TTrackSource

Parameters

ParameterType
propsUseRoomProps

Returns

{
  room: unknown;
  htmlProps: HTMLAttributes<T>;
}

room

room: unknown;

htmlProps

htmlProps: HTMLAttributes<T>;

Example

const { room, htmlProps } = useRoom({ serverUrl: undefined, token: undefined, connect: true });
return <div {...htmlProps}>{room ? "Connected" : "No local room"}</div>;

On this page

Valora is local-first

No API key, no server — everything in this doc runs on-device.

Star on GitHub