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> );} Copy
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> );}
The local user's ID, null if not connected
Map of participants indexed by userId
Participants state with all remote participants.
Remarks
Contains a Map of all participants indexed by userId, plus the local user's ID for identifying which participant is local.
Example
Listing participants:
See