LiveKit docs › React components › 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-11-14T15:36:07.467Z.
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).