📆 Don't miss our Sanity Showcase virtual meetup on March 20th!
@beta
function

unstable_useObserveDocument()

Observes a document by its ID and returns the document and loading state it will listen to the document changes.

Import

import {unstable_useObserveDocument} from 'sanity'

Signature

function unstable_useObserveDocument<T extends SanityDocument>(documentId: string, apiConfig: ObserveDocumentAPIConfig): {
  document: T | null
  loading: boolean
}
function unstable_useObserveDocument<T extends SanityDocument>(documentId: string, apiConfig: ObserveDocumentAPIConfig): {
  document: T | null
  loading: boolean
}

Returns

{
  document: T | null
  loading: boolean
}
{
  document: T | null
  loading: boolean
}
sanity@3.79.0