Valora
API Reference@valora-ai/reactindexFunctions

useConnectionState

function useConnectionState(): VoiceConnectionState;

Defined in: packages/react/src/hooks/connection/useConnectionState.ts:28

The room connection lifecycle for the current <VoiceRoom>.

Returns

VoiceConnectionState

Example

// Basic — branch on the current room connection state.
const state = useConnectionState();
if (state === "connecting") return <Spinner />;

// Advanced — pair connection state with room audio.
function ConnectionGate() {
  const state = useConnectionState();

  return (
    <VoiceRoom agent={agent}>
      {state === "connected" ? <RoomAudioRenderer /> : <p>{state}</p>}
      <VoiceAssistantControlBar controls={{ microphone: true, leave: true }} />
    </VoiceRoom>
  );
}

On this page

Valora is local-first

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

Star on GitHub