Valora
API Reference@valora-ai/reactindexFunctions

useEnsureParticipant

function useEnsureParticipant(participant?): unknown;

Defined in: packages/react/src/hooks/participant/useEnsureParticipant.ts:31

Ensures that a participant is provided, either via context or explicitly as a parameter. If not inside a ParticipantContext and no participant is provided, an error is thrown.

Parameters

ParameterType
participant?unknown

Returns

unknown

Example

// Basic — require a participant from props or context.
const participant = useEnsureParticipant();

// Advanced — render participant-aware quality UI.
function ParticipantQuality({ participant }: { participant?: Participant }) {
  const ensuredParticipant = useEnsureParticipant(participant);
  const { quality } = useConnectionQualityIndicator({ participant: ensuredParticipant });

  return (
    <ParticipantContext participant={ensuredParticipant}>
      <ConnectionQualityIndicator />
      <span>{quality}</span>
    </ParticipantContext>
  );
}

On this page

Valora is local-first

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

Star on GitHub