LiveKit docs › Hooks › useEnsureSession

---

# useEnsureSession

> ℹ️ **Note**
> 
> This feature is under active development and may change based on developer feedback and real-world usage.

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

## Import

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

```

## Properties

- **`session`** _(UseSessionReturn)_ (optional): 

## Returns

```typescript
UseSessionReturn;

```

---

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

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