UNPKG

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

19 lines (14 loc) 393 B
import {useContext} from 'react' import {CommentsContext} from 'sanity/_singletons' import {type CommentsContextValue} from '../context/comments/types' /** * @beta * @hidden */ export function useComments(): CommentsContextValue { const value = useContext(CommentsContext) if (!value) { throw new Error('useComments must be used within a CommentsProvider') } return value }