import { Thread, ThreadProvider } from "stream-chat-react";
<ThreadProvider thread={/*...*/}>
<Thread />
</ThreadProvider>;
ThreadContext
ThreadContext
- just like any other React context - is used for dependency injection. What makes it different in this case is ThreadProvider
.
ThreadProvider
Is a provider which wraps Channel
component and takes Thread
instance as a value. The Channel
wrapper acts as a temporary measure to make Thread
component compatible with the new architecture which relies on Thread
instance. The reliance on channel is temporary and will become deprecated in the future.
Thread component newly prioritizes Thread
instance if rendered under ThreadProvider
otherwise falls back to accessing thread from Channel
state.
Basic Usage
- I'm working with the Stream Chat React SDK and would like to ask questions about this documentation page: https://getstream.io/chat/docs/sdk/react/components/contexts/thread-context.md
- View as markdown
- Open in ChatGPT
- Open in Claude
On this page: