sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
15 lines (10 loc) • 391 B
text/typescript
import {useContext} from 'react'
import {CommentInputContext} from 'sanity/_singletons'
import {type CommentInputContextValue} from './CommentInputProvider'
export function useCommentInput(): CommentInputContextValue {
const ctx = useContext(CommentInputContext)
if (!ctx) {
throw new Error('useCommentInputContext must be used within a CommentInputProvider')
}
return ctx
}