Sanity Library Reference Docs
    Preparing search index...
    interface SanityAppProps {
        children: ReactNode;
        config?: SanityConfig | SanityConfig[];
        fallback: ReactNode;
        inferMediaLibraryAndCanvas?: boolean;
        resources?: Record<string, DocumentResource>;
        sanityConfigs?: SanityConfig[];
    }
    Index

    Properties

    children: ReactNode

    One or more SanityConfig objects providing a project ID and dataset name. Optional when SanityApp is rendered inside an SDKStudioContext provider (e.g. inside Sanity Studio) — the config is derived from the workspace automatically.

    fallback: ReactNode
    inferMediaLibraryAndCanvas?: boolean

    Set this to automatically fetch and register the organization's media library and canvas as named resources. These resources will be available to hooks as media-library and canvas.

    The SDK App must be running in the organization's Dashboard to use this feature.


    const MyApp = () => {
    // should "just work" because of inferMediaLibraryAndCanvas.
    const {data: assets} = useDocuments({
    documentType: 'sanity.asset',
    resourceName: 'media-library',
    })
    return (
    <div>
    {assets.map((asset) => (
    <div key={asset._id}>{asset.originalFilename}</div>
    ))}
    </div>
    )
    }
    <SanityApp inferMediaLibraryAndCanvas>
    <MyApp />
    </SanityApp>
    resources?: Record<string, DocumentResource>
    sanityConfigs?: SanityConfig[]

    use the config prop instead.