LiveKit docs › Hooks › useTrackRefContext

---

# useTrackRefContext

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

## Import

```typescript
import { useTrackRefContext } from "@livekit/components-react";

```

## Returns

```typescript
TrackReferenceOrPlaceholder;

```

---

This document was rendered at 2026-06-07T11:32:18.925Z.
For the latest version of this document, see [https://docs.livekit.io/reference/components/react/hook/usetrackrefcontext.md](https://docs.livekit.io/reference/components/react/hook/usetrackrefcontext.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).