Valora
API Reference@valora-ai/reactindexFunctions

useSortedParticipants

function useSortedParticipants(participants): unknown[];

Defined in: packages/react/src/hooks/participant/useSortedParticipants.ts:30

The useSortedParticipants hook returns the participants sorted by importance.

Parameters

ParameterType
participantsunknown[]

Returns

unknown[]

Example

// Basic — sort an existing participant list.
const sortedParticipants = useSortedParticipants(participants);

// Advanced — render important participants first.
function SortedRoster() {
  return (
    <VoiceRoom agent={agent}>
      <SortedParticipantList />
      <RoomAudioRenderer />
    </VoiceRoom>
  );
}
function SortedParticipantList() {
  const participants = useParticipants();
  const sortedParticipants = useSortedParticipants(participants);
  return <ParticipantLoop participants={sortedParticipants}><ParticipantName /></ParticipantLoop>;
}

On this page

Valora is local-first

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

Star on GitHub