import { createContext, PropsWithChildren, useContext } from 'react'; import { Call } from '@stream-io/video-client'; const StreamCallContext = createContext(undefined); /** * The props for the StreamCallProvider component. */ export interface StreamCallProviderProps { /** * The call instance to provide to the component tree. */ call?: Call; } /** * A provider for the call object. */ export const StreamCallProvider = ( props: PropsWithChildren, ) => { const { call, children } = props; return ( {children} ); }; /** * A hook to get the call object from the closest provider. */ export const useCall = () => { return useContext(StreamCallContext); };