UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

10 lines (9 loc) 475 B
import React, { createContext, useContext } from 'react'; import { Channel } from '../../components'; export const ThreadContext = createContext(undefined); export const useThreadContext = () => { const thread = useContext(ThreadContext); return thread ?? undefined; }; export const ThreadProvider = ({ children, thread, }) => (React.createElement(ThreadContext.Provider, { value: thread }, React.createElement(Channel, { channel: thread?.channel }, children)));