Hiyve Components - v1.0.0
    Preparing search index...

    Interface ParticipantsState

    Participants state with all remote participants.

    Contains a Map of all participants indexed by userId, plus the local user's ID for identifying which participant is local.

    Listing participants:

    function ParticipantsList() {
    const { participants, localUserId, participantCount } = useParticipants();

    return (
    <div>
    <h2>Participants ({participantCount})</h2>
    {participants.map((p) => (
    <div key={p.userId}>
    {p.userId === localUserId ? 'You' : p.userName || p.userId}
    </div>
    ))}
    </div>
    );
    }
    interface ParticipantsState {
        localUserId: string | null;
        participants: Map<string, Participant>;
    }
    Index

    Properties

    localUserId: string | null

    The local user's ID, null if not connected

    participants: Map<string, Participant>

    Map of participants indexed by userId