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 Parameter | Default type |
|---|---|
T | TrackSource |
Parameters
| Parameter | Type |
|---|---|
props | UseRoomProps |
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>;