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
On this page: