botframework-webchat-component
Version:
React component of botframework-webchat
14 lines (9 loc) • 411 B
text/typescript
import { useContext } from 'react';
import TranscriptFocusContext from './Context';
export default function useTranscriptFocusContext(throwOnUndefined = true) {
const contextValue = useContext(TranscriptFocusContext);
if (throwOnUndefined && !contextValue) {
throw new Error('botframework-webchat internal: This hook can only be used under <TranscriptFocusComposer>.');
}
return contextValue;
}