---
id: thread-context
title: ThreadContext
---

import AllowThreadMessagesInChannel from '../common-content/core-components/channel/props/allow_thread_messages_in_channel.mdx'
import Thread from '../common-content/core-components/channel/props/thread.mdx'

import CloseThread from '../common-content/contexts/thread-context/close_thread.mdx'
import LoadMoreThread from '../common-content/contexts/thread-context/load_more_thread.mdx'
import OpenThread from '../common-content/contexts/thread-context/open_thread.mdx'
import ReloadThread from '../common-content/contexts/thread-context/reload_thread.mdx'
import SetThreadLoadingMore from '../common-content/contexts/thread-context/set_thread_loading_more.mdx'
import ThreadHasMore from '../common-content/contexts/thread-context/thread_has_more.mdx'
import ThreadLoadingMore from '../common-content/contexts/thread-context/thread_loading_more.mdx'
import ThreadMessages from '../common-content/contexts/thread-context/thread_messages.mdx'

`ThreadContext` is provided by [`Channel`](../core-components/channel.mdx) component. If you are not familiar with React Context API, please read about it on [React docs](https://reactjs.org/docs/context.html).

## Basic Usage

`ThreadContext` can be consumed by any of the child  component of `Channel` component as following:

```tsx
import { useContext } from 'react';
import { ThreadContext } from 'stream-chat-react-native';

const value = useContext(ThreadContext);
```

Alternatively, you can also use `useThreadContext` hook provided by library to consume ThreadContext.

```tsx
import { useThreadContext } from 'stream-chat-react-native';

const value = useThreadContext();
```

## Value

### <div class="label description">_forwarded from [Channel](../core-components/channel.mdx#allowthreadmessagesinchannel)_ props</div> allowThreadMessagesInChannel {#allowthreadmessagesinchannel}

<AllowThreadMessagesInChannel />

### closeThread

<CloseThread />

### loadMoreThread

<LoadMoreThread />

### openThread

<OpenThread />

### reloadThread

<ReloadThread />

### setThreadLoadingMore

<SetThreadLoadingMore />

### <div class="label description">_forwarded from [Channel](../core-components/channel.mdx#thread)_ props</div> thread {#thread}

<Thread />

### threadHasMore

<ThreadHasMore />

### threadLoadingMore

<ThreadLoadingMore />

### threadMessages

<ThreadMessages />
