Valora
API Reference@valora-ai/reactindexFunctions

useTrackRefContext

function useTrackRefContext(): unknown;

Defined in: packages/react/src/hooks/track/useTrackRefContext.ts:31

Ensures that a track reference is provided via context. If not inside a TrackRefContext, an error is thrown.

Returns

unknown

Example

// Basic — read the current track from TrackRefContext.
const trackRef = useTrackRefContext();

// Advanced — consume each TrackLoop item from context.
function CameraTile() {
  const trackRef = useTrackRefContext();
  return <ParticipantTile trackRef={trackRef} />;
}

function CameraGrid() {
  const tracks = useTracks([{ source: Track.Source.Camera, withPlaceholder: true }]);
  return (
    <TrackLoop tracks={tracks}>
      <CameraTile />
    </TrackLoop>
  );
}

On this page

Valora is local-first

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

Star on GitHub