Sanity Library Reference Docs
    Preparing search index...

    Function useReferringDocuments

    • Beta

      Subscribe to a live-updating list document referring to the document of the passed ID A new list of document will be emitted every time a document refers or no longer refers to the document of the given ID

      The returned list of referring documents is not extensive, will only return the 101 first documents.

      For every component that calls this hook, a new listener connection will be made to the backed.

      Make sure call this hook sparingly

      Type Parameters

      Parameters

      • id: string

        id of document to search for referring documents for

      • fields: string[] = DEFAULT_FIELDS

        which fields to return for each document (defaults to _id and _type). Pass an empty array to return full documents

      Returns ReferringDocumentsState<DocumentType> | ReferringDocumentsState<never>