# ThreadContext

`ThreadContext` provides thread data via React context. It’s populated by `ThreadProvider`.

## Best Practices

- Prefer `ThreadProvider` when you have a `Thread` instance already available.
- Keep `ThreadProvider` scoped to the thread view to avoid unnecessary context updates.
- Rely on `Thread`’s built-in fallback to `Channel` state only when needed.
- Avoid mixing multiple thread sources in the same subtree.
- Keep thread data updates centralized to prevent inconsistent UI.

## ThreadProvider

`ThreadProvider` wraps [`Channel`](/chat/docs/sdk/react/v13/components/core-components/channel/) and provides a [`Thread` instance](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts). The `Channel` wrapper is a temporary compatibility layer while the SDK transitions to using a `Thread` instance directly.

`Thread` prioritizes the provided [`Thread` instance](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) when rendered under `ThreadProvider`; otherwise it falls back to thread data from [`Channel` state](/chat/docs/sdk/react/v13/components/contexts/channel_state_context/).

### Basic Usage

```tsx
import { Thread, ThreadProvider } from "stream-chat-react";

<ThreadProvider thread={/*...*/}>
  <Thread />
</ThreadProvider>;
```


---

This page was last updated at 2026-04-21T07:55:47.544Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react/v13/components/contexts/thread-context/](https://getstream.io/chat/docs/sdk/react/v13/components/contexts/thread-context/).