UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

15 lines (14 loc) 634 B
import * as React from 'react'; const Context = React.createContext(undefined); const CurrentThreadListProvider = ({ children, currentThread }) => { const value = React.useMemo(() => ({ currentThread }), [currentThread]); return (React.createElement(Context.Provider, { value: value }, children)); }; const useCurrentThreadListContext = () => { const context = React.useContext(Context); if (!context) { throw new Error("useCurrentThreadListContext must be used within a CurrentThreadListProvider"); } return context; }; export { CurrentThreadListProvider, useCurrentThreadListContext };