useParticipantProperty
useParticipantProperty(sessionId: string, propertyPath: string | string[]): participant[propertyPath]
useParticipantProperty returns the requested property belonging to any given session_id.
Use this hook instead of useParticipant when you only need to subscribe to a small subset of participant properties to optimize for React render cycles. useParticipant triggers a re-render when any property in the requested participant object changes. useParticipantProperty only triggers a re-render when the selected property changes.
Params
| Parameter | Required | Type | Description |
|---|---|---|---|
session_id | ✓ | string | A unique identifier for the participant |
propertyPath | ✓ | string | string [] | The path to a desired participant property, in relation to the parent participant object. Eg: "tracks.audio.subscribed" |
Return type
| Type | Description |
|---|---|
typeof participant[propertyPath] | The value of the requested property, which will be the type of the requested property |
Sample code
Related references
- useActiveParticipant()
- useActiveSpeakerId()
- useLocalParticipant()
- useLocalSessionId()
- useParticipantCounts()
- useParticipantIds()
- useParticipant()
- useWaitingParticipants()