useParticipantProperty

useParticipantProperty(string, string): any

useParticipantProperty returns the requested property belonging to any given session_id.

Use this hook instad 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

ParameterRequiredTypeDescription
session_idstringA unique identifier for the participant
propertyPathstringThe path to a desired participant property, in relation to the parent participant object. Eg: "tracks.audio.subscribed"

Return type

TypeDescription
anyThe value of the requested property, which can be of any type

Sample code