Sanity Library Reference Docs
    Preparing search index...

    Interface ResourceHandle<TDataset, TProjectId>

    React SDK resource handle — extends the core DatasetHandle with resourceName for context-based resource resolution.

    Use this (or its subtypes) as the options type for custom hooks that need to accept a resource. It accepts a resource object, a resourceName registered via the resources prop on <SanityApp>, or a bare projectId/dataset pair for backward compatibility.

    interface ResourceHandle<
        TDataset extends string = string,
        TProjectId extends string = string,
    > {
        dataset?: TDataset;
        perspective?: ReleasePerspective | ClientPerspective;
        projectId?: TProjectId;
        resource?: DocumentResource;
        resourceName?: string;
        source?: DocumentResource;
    }

    Type Parameters

    • TDataset extends string = string
    • TProjectId extends string = string

    Hierarchy (View Summary)

    Index

    Properties

    dataset?: TDataset
    projectId?: TProjectId
    resource?: DocumentResource

    Explicit resource object to use for this operation.

    resourceName?: string

    Name of a resource registered via the resources prop on <SanityApp>. Resolved to a DocumentResource at the React layer.

    Use resource instead.