LiveKit docs › Hooks › useEnsureRoom

---

# useEnsureRoom

Ensures that a room is provided, either via context or explicitly as a parameter. If no room is provided, an error is thrown.

## Import

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

```

## Properties

- **`room`** _(Room)_ (optional): 

## Returns

```typescript
Room;

```

---

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

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