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
16 lines (11 loc) • 440 B
text/typescript
import {useContext} from 'react'
import {DocumentChangeContext} from 'sanity/_singletons'
import {type DocumentChangeContextInstance} from '../contexts/DocumentChangeContext'
/** @internal */
export function useDocumentChange(): DocumentChangeContextInstance {
const documentChange = useContext(DocumentChangeContext)
if (!documentChange) {
throw new Error('DocumentChange: missing context value')
}
return documentChange
}